You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many inconsistencies in the treatment of strings. It should probably be standardised across drivers and reql functions, and documented.
The python driver refuses non-ascii strings unless they are unicode:
python> r.expr('\xc1').run()
File "/Library/Python/2.7/site-packages/google/protobuf/internal/type_checkers.py", line 128, in CheckValue
(proposed_value))
ValueError: '\xc1' has type str, but isn't in 7-bit ASCII encoding. Non-ASCII strings must be converted to unicode objects before being added.
The ruby driver lets you use strings that are not utf8:
ruby> r.expr("\xc1").run
=> "\301"
The python drivers fails badly when receiving a non-utf8 string:
ruby> r.table('foo').insert({:a=>"\xc1"}).run
python> r.table('foo').run()
File "/Library/Python/2.7/site-packages/google/protobuf/internal/decoder.py", line 410, in DecodeField
field_dict[key] = local_unicode(buffer[pos:new_pos], 'utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc1 in position 0: invalid start byte
r.js expects strings to be utf-8, and gets confused when they are not:
I'm having a problem where I send a UTF-8 string from the browser to a Node.js server using the RethinkDB driver and it saves the string with garbage, what should I do?
This has been superseded by #3301 , which includes a verification step. @gchpaco has already implemented that part (currently in code review).
Closing as duplicate.
In next now, we enforce UTF-8 on input strings. When I get some other stuff done, I will be able to fix split to be safe, at which point it should not be easy to insert invalid UTF-8 strings into the database. Not included here is any form of locale support, which is the toupper/tolower stuff as well as collation; I feel that's grist for a different mill.
@danielmewes Do you want me to close this now, or wait until we get split in?
Activity
mlucy commentedon Jul 18, 2013
Labeling this as a RQL proposal, since it involves standardizing RQL strings.
srh commentedon Mar 5, 2014
I'm relabeling this a bug. If theres an octet-string type the driver must handle it properly, not by sending garbage UTF-8.
thelinuxlich commentedon Apr 3, 2014
I'm having a problem where I send a UTF-8 string from the browser to a Node.js server using the RethinkDB driver and it saves the string with garbage, what should I do?
coffeemug commentedon Apr 3, 2014
Hi @thelinuxlich! What do you mean "from the browser to a Node.js server using the RethinkDB driver"? Could you post the queries here?
thelinuxlich commentedon Apr 3, 2014
The error was on my side, sorry guys!
danielmewes commentedon Dec 11, 2014
This has been superseded by #3301 , which includes a verification step. @gchpaco has already implemented that part (currently in code review).
Closing as duplicate.
AtnNn commentedon Dec 12, 2014
@danielmewes The solution you mention explicitly still allows non-utf-8 strings. Perhaps we should open another issue for those cases.
1 remaining item
gchpaco commentedon Jan 8, 2015
In
nextnow, we enforce UTF-8 on input strings. When I get some other stuff done, I will be able to fixsplitto be safe, at which point it should not be easy to insert invalid UTF-8 strings into the database. Not included here is any form of locale support, which is thetoupper/tolowerstuff as well as collation; I feel that's grist for a different mill.@danielmewes Do you want me to close this now, or wait until we get
splitin?gchpaco commentedon Jan 8, 2015
Per private discussion, there's a followup ticket for that in #3531.