List:General Discussion« Previous MessageNext Message »
From:Barbara Deaton Date:November 28 2006 3:16am
Subject:Problems inserting chinese characters
View as plain text  
All,

I have an application in which I am trying to insert some traditional Chinese characters. 
The insert statement probably won't cut and paste correctly but it is: insert into
"TKTS13" values (2,'ÄãºÃ', 'ÄãºÃ');

I have used this website http://people.w3.org/rishida/scripts/uniview/conversion to
validate that when I view my insert statement in the visual c debugger my values are
correct:

insert into `TKTS13` (`TKTSCOL1`, `TKTSCOL2`, `TKTSCOL3`)  values(2,
'\xE4\xBD\xA0\xE5\xA5\xBD', '\xE4\xBD\xA0\xE5\xA5\xBD') 

E4BDA0 E5A5BD are the correct Chinese characters.

However, when I then go to the MySQL Command line and do a select * from the table I get
?? For my data.

mysql> select * from TKTS13;
+----------+----------+----------+
| TKTSCOL1 | TKTSCOL2 | TKTSCOL3 |
+----------+----------+----------+
|        2 | ??       | ??       |
+----------+----------+----------+
2 rows in set (0.00 sec)

mysql> select hex(TKTSCOL2) from TKTS13 where TKTSCOL1=2;
+---------------+
| hex(TKTSCOL2) |
+---------------+
| 3F3F          |
+---------------+
2 rows in set (0.00 sec)

It looks like the Hex representation isn't correct.  I turned on binary logging and in the
log file I see insert statement just like I see it in the debugger.  So it appears that
the SQL is sent to the server correctly.  I just don't understand why it isn't being
stored correctly.

I'm using the prepared statement API to prepare and execute the insert statement.

My client and server are 5.1 and the server is running in UTF8.

Any help would be appreciated.

Thanks for your time,
Barbara
Thread
mysql_fetch_row problemИгорь Александров24 Nov
  • Problems inserting chinese charactersBarbara Deaton28 Nov
    • Re: Problems inserting chinese charactersYonghua.Wu28 Nov