问题
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