Wednesday, March 09, 2005


Character set problem again!

I think MySQL 4.1 does a really good job in character set issue. But I think the documentation can be better. I understand the concept of character_set_client, character_set_connection, character_set_results. But it doesn't work on me. Here is what I've tried out.

Default_character_set = utf8
(1) Enter mysql prompt, do nothing, select a table. The Chinese characters are shown corrrectly. No matter the character_set of the database is set to utf8 or the default latin1

(2)mysql> set NAMES utf8; (or set character_set_client= utf8; set character_set_connection= utf8; set character_set_result= utf8)
mysql> select * from comp_type;

All Chinese characters are corrupted.

(3) set NAMES utf8;
set character_set_result= latin1;

All Chinese are correctly shown.

Here is the explaination of character set from MySQL website.
Why this happens?

This doesn't really hurt because I can use latin1 instead of utf8(the database is still utf8) but just don't understand. :(


Post a Comment

<< Home