5

I'm trying to get Unicode working properly in rails using MySQL. Now, Rails displays the text correctly, but it shows up as ??? in MySQL. Additionally, I am not able to filter the text.

My MySQL database has been configured with the utf8 character set. My client character is also UTF8. Likewise, rails is set to use UTF8.

If I enter the Unicode string directly from the MySQL client, it is stored properly in the table, but Rails does not correctly display it.

How do I get the data in, properly formatted in the database?

1
  • Please, make sure your yaml config file has the encoding: utf-8 line and provide us with the output of the following query: show variables like 'char%';. If you're at Windows what code page does the chcp command say is being used? Commented Dec 9, 2008 at 12:10

2 Answers 2

3

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

encoding: utf8

Sign up to request clarification or add additional context in comments.

Comments

0

Perhaps whatever you're using to view your database isn't configured properly for unicode. For instance, if you're using a terminal in some linux distro: the terminal shell may not be configured correctly to display unicode characters.

1 Comment

Its not just a display issue. Filtering, even from the rails application, doesn't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.