Saturday, March 13, 2010

MySQL Problem with Japanese/UTF-8 texts

If you have tried to put Japanese or UTF-8 texts in MySQL, chances are it will show “junky” characters after you save/reopen it. An adjustment is needed to fix this simple problem:

Declare the data type as VarBinary. Problem solved.
I’ve tried changing the character set to UTF-8, using the “mysql_enable_utf8=1” setting, making SQL query like “SET CHARACTER SET utf8_unicode_ci;”, nothing seems working. Anyway the simple solution above solved the problem. I have tried it with MySQL 5.x.

Pitfall: If you are using SQLyog as your MySQL manager, you need to use version 6 of above to get it work. Anything less will not work even if you declare the data type as VarBinary.

No comments:

Post a Comment