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
The adapter ignores the default charset, if I use utf8 It should return UTF-8 encoded strings, but It always returns ASCII-8BIT strings.
This is a problem concatenating strings in Ruby, becase UTF-8 and ASCII-8BIT are not compatible, for example this causes an error if the string containts any of the characters á é í ó ú.
I didn't tackle character set encodings, because I thought I would need to transliterate based on database and column charsets, but it shouldn't be hard to call force_encoding on all returned strings with the encoding specified at the connection level. Would that be acceptable?
If your data is not valid according to the specified encoding, it would fail later operations like regular expressions.
On Feb 13, 2012, at 2:43 PM, ramsees wrote:
The adapter ignores the default charset, if I use utf8 It should return UTF-8 encoded strings, but It always returns ASCII-8BIT strings.
This is a problem concatenating strings in Ruby, becase UTF-8 and ASCII-8BIT are not compatible, for example this causes an error if the string containts any of the characters á é í ó ú.
The adapter ignores the default charset, if I use utf8 It should return UTF-8 encoded strings, but It always returns ASCII-8BIT strings.
This is a problem concatenating strings in Ruby, becase UTF-8 and ASCII-8BIT are not compatible, for example this causes an error if the string containts any of the characters á é í ó ú.
"Hello" + data["my_string"]
I need to do this
"Hello" + data["my_string"].force_encoding("UTF-8")
Doing this is tedious, specially in Sinatra applications.
The text was updated successfully, but these errors were encountered: