Mysql2 gem not working with UTF8

两盒软妹~` 提交于 2019-12-22 00:25:17

问题


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).

来源:https://stackoverflow.com/questions/5084975/mysql2-gem-not-working-with-utf8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!