Rails + MySQL Unicode

I am trying to get Unicode to work correctly in rails using MySQL. Now Rails displays the text correctly, but it displays like ??? in MySQL. Also, I cannot filter the text.

My MySQL database was configured with utf8 character set. My client character is also UTF8. Similarly, rails are configured to use UTF8.

If I enter the Unicode string directly from the MySQL client, it will be correctly saved in the table, but Rails will not display it correctly.

How to get the data correctly formatted in the database?

+4
source share
2 answers

Have you tried adding this to your database.yml in your environment?

encoding: utf8

+3
source

Perhaps everything you use to view your database is incorrectly configured for unicode. For example, if you use the terminal in some linux distribution: the terminal shell may not be properly configured to display Unicode characters.

0
source

All Articles