Bug #17760 | Chinese Words Cannot Read | ||
---|---|---|---|
Submitted: | 28 Feb 2006 3:35 | Modified: | 2 Jun 2006 3:41 |
Reporter: | Alex Lam | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | MySQL 4.0 | OS: | Windows (Windows 2000) |
Assigned to: | Reggie Burnett | CPU Architecture: | Any |
[28 Feb 2006 3:35]
Alex Lam
[1 Mar 2006 12:20]
Valeriy Kravchuk
Thank you for a problem report. Have you tried to execute "set names utf8" or other ways to set proper character set and collation in the client program? Do you use MySQL Connector/ODBC in .Net or MySQL Connector/Net directly? And, finally, inform about the driver version.
[3 Mar 2006 1:17]
Alex Lam
I tried MySQL Connector )DBC 3.51.12 in VB .Net to do the same thing, nearly use most of the same codes except the connection string, it works. There is no need to do any setting for character set and collation. The version for MySQL Connector Net that I used is version 1.07. If this version need to set somthings before collecting non-English characters, how to set. Please help. Thanks.
[26 May 2006 18:25]
Reggie Burnett
What is the server character set? Do a show variables like '%character_set%' and let me know what the output is.
[1 Jun 2006 1:25]
Alex Lam
The character set is latin. However, use MySQL ODBC 3.51 Driver is Ok.
[1 Jun 2006 18:36]
Reggie Burnett
Alex The reason that works with ODBC is because neither the ODBC driver nor the server is performing any type of conversion on the characters so whatever you push in comes back out exactly the same. This is not true with Connector/net. Let me explain. In .NET, all strings are Unicode. However, I have to communicate to the MySQL server using the character set that it is expecting. When the .NET connector starts up, it asks the server what character set it is running with. When you pass in a query using a Chinese character set (or using Unicode), that string is converted to whatever character set the server is using and then converted back on the return. This two way conversion wrecks your Chinese characters. The solution is to tell the connector what character set to use. You do this with the charset option on the connection string. Something like this: charset=utf8 or charset=big5 or charset=gb2312
[2 Jun 2006 3:41]
Alex Lam
The problem is solved. Thank you very much for your kind support.