I have a table named CHINESE
which has only one column NAME
.
The output of SHOW VARIABLES LIKE 'char%'
is:
+--------------------------+--------------------------------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql-5.1.73-osx10.6-x86_64/share/charsets/ | +--------------------------+--------------------------------------------------------+
When I run this query: INSERT INTO CHINESE VALUES ('你好')
, the values get inserted.
But, when I try to execute this query: SELECT * FROM CHINESE
, the result is:
+------+ | NAME | +------+ | ?? | +------+
The result of SELECT HEX(NAME) FROM CHINESE
is:
+-----------+ | HEX(NAME) | +-----------+ | 3F3F | +-----------+
Where am I making mistake?
utf8
, make a new database and test table, insert there, and see if it works. I think you've got UTF-8 data but the server's doing conversion as if it was Latin1. – tadman