There is this mysql database I'm trying to connect to. DataMapper fetches everything nicely in UTF-8 but Sequel always returns strings in ASCII-8bit which produces errors with .to_json.
I have tried several things in order to get it to work.
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
DB.run 'set names utf8'
Sequel.mysql 'db', (...), :encoding => 'utf-8'
I have gems: mysql (2.9.0) (tried without), mysql2 (0.3.11) and sequel (3.42.0)
The only thing that works is manually forcing the encoding on every string which is MUCH less than ideal.
Try
Sequel.mysql2
instead ofSequel.mysql
.Sequel.mysql
uses the oldmysql
driver instead of the newmysql2
driver, and I don't believe themysql
driver supports encodings.Encoding can be passed as do :