MySQL Forums
Forum List  »  Japanese

Re: Japanese Characters Storing
Posted by: Peter Dennis
Date: November 30, 2007 01:33AM

It sounds like whatever client you are using to view the database can't display Japanese characters correctly.

I was getting something similar when trying to insert data into a table. Kept getting duplicate key errors but couldn't see which kanji it was happening on because the mysql client would return the following:
ERROR 1062 (23000): Duplicate entry '題' for key 2

I checked my character set variables with:
mysql> show variables like "%char%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

I then changed all of them to utf8. You can do this with statements like:
mysql> SET character_set_server="utf8";

The insert then succeeded. So then I tried to insert another kanji that I knew was already in the table. As per:
INSERT INTO Kanji SET kanji="頭";
ERROR 1062 (23000): Duplicate entry '頭' for key 2

You probably don't need to change all of them to utf8. I have a feeling that you only need your 'character_set_server' and 'character_set_client' speaking the same language (i.e. utf8). (This could be a great example of irony but i never know the definition of this word).

Good luck. 頑張って!



Edited 1 time(s). Last edit at 11/30/2007 03:13PM by Peter Dennis.

Options: ReplyQuote


Subject
Views
Written By
Posted
18627
August 31, 2007 05:03AM
Re: Japanese Characters Storing
13022
November 30, 2007 01:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.