Mysql2 gem not working with UTF8

2020-07-30 01:54发布

I've switched my Rails app from the Mysql gem to Mysql2, but now UTF8 fields aren't working; specifically, the character á is coming out as á. The character appears correctly in the MySQL console, when using PHP, and when using the Mysql gem. I have set encoding: utf8 in my database.yml file.

Potentially helpful

When I inspect it character-for-character in the console, I see that á is "\303\241" (using the Mysql gem) but á is "\303\203\302\241" (using the Mysql2 gem).

0条回答
登录 后发表回答