forums › forums › SQLyog › Using SQLyog › Chinese Text Displaying As ?
- This topic is empty.
-
AuthorPosts
-
-
February 4, 2010 at 6:13 am #11865khwajaMember
HI
I created a table name login first_name varchar(64) charset=UTF8 collation=utf8_general_ci and last_name varchar(64) with same charset and collation.
Now when iam inserting values like INSERT INTO login (first_name,last_name)VALUES('海峽定義','chinese'). Its working fine..
But when iam inserting the same chinese text from the textbox in winforms (c#) its displaying as ????? in table
Here iam using : mysqlserver version : 5.1.25-rc-community
sqlyog : v 8.1
connection string:
MySQLCon = new MySQLConnection(MySQLConString.AsString + “;charset=utf8”);
Iam using mysqldriver.cs as a connector
show variables like 'char%'
character_set_client –> utf8
character_set_connection –> utf8
character_set_database –> utf8
character_set_filesystem –> binary
character_set_results –> utf8
character_set_server –> utf8
character_set_system –> utf8
character_set_dir –> C:Program FilesMySQLMySQL Server
5.1sharecharsets
SHOW VARIABLES LIKE 'col%'
collation_connection –> utf8_general_ci
collation_server –> utf8_general_ci
collation_database –> utf8_general_ci
can u please help me to fix this problem
I also tried with big5,ucs2,and gbk also.
-
February 4, 2010 at 7:02 am #30459peterlaursenParticipant
well .. looks like a problem with Winforms and not SQLyog. I do not know how Winforms handles Chinese. There is no configuration option to make it use utf8?
My guess is that Winforms (being a Microsoft program) will use 'utf16 with little-endian byte-order' (also known as 'Windows Unicode') and not 'utf8' to represent Unicode (at least as default). MySQL does not support 'Windows Unicode'. It supports utf8 and ucs2 (what is *almost* the same as 'utf16 with big-endian byte-order'. You can easily identify it what is stored in the table, as in utf8 Chinese characters are 3 bytes long (whereas in utf16 (and also non-unicode Chinese character sets to my knowledge) they are 2 bytes long.
Please execute
Code:SHOW CREATE TABLE tablename;for the table you are inserting to. We need first to be sure that the table definition does not have another charset than server default.
Also please try to insert a small Chinese string from both SQLyog and Winforms (same string with both – and paste it here in clear text) and next execute
Code:SELECT HEX(columnname) FROM thetable; -
February 4, 2010 at 7:12 am #30460khwajaMember'peterlaursen' wrote on '04:
well .. looks like a problem with Winforms and not SQLyog. I do not know how Winforms handles Chinese. There is no configuration option to make it use utf8?
My guess is that Winforms (being a Microsoft program) will use 'utf16 with little-endian byte-order' (also known as 'Windows Unicode') and not 'utf8' to represent Unicode (at least as default). MySQL does not support 'Windows Unicode'. It supports utf8 and ucs2 (what is *almost* the same as 'utf16 with big-endian byte-order'. You can easily identify it what is stored in the table, as in utf8 Chinese characters are 3 bytes long (whereas in utf16 (and also non-unicode Chinese character sets to my knowledge) they are 2 bytes long.
Please execute
Code:SHOW CREATE TABLE tablename;for the table you are inserting to. We need first to be sure that the table definition does not have another charset than server default.
Also please try to insert a small Chinese string from both SQLyog and Winforms (same string with both – and paste it here in clear text) and next execute
Code:SELECT HEX(columnname) FROM thetable; -
February 4, 2010 at 7:16 am #30461peterlaursenParticipant
You did not really reply to any question! :huh:
-
February 4, 2010 at 7:18 am #30462khwajaMember
Hi.
Yeah when iam inserting the query like INSERT INTO details VALUES('海峽定義','chinese') from sqlyog its working fine.
But when coming to winfrom(c#) when iam using the same query, in table its dispalying as ????
SELECT HEX(first_name) FROM details :
海峽定義–> E38381E383A3E3838ABE5AAE9AE7BEA920 (INSERT FROM SQLYOG)
????–> 3F3F3F3F
and i also used the same charset for table and for server.
create table details:
CREATE TABLE `details` (
`first_name` varchar(32) DEFAULT NULL,
`last_name` varchar(32) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC
thanks
Khwaja
-
February 4, 2010 at 7:22 am #30463peterlaursenParticipant
How do you connect to MySQL? Are you using ODBC or Connector.NET?
-
February 4, 2010 at 8:26 am #30464peterlaursenParticipant
I can see that you have already posted heretoo:
http://bugs.mysql.com/bug.php?id=50868
basically this is the right place. We do not use C# in combination with MySQL so we do not have a ready reply to this.
-
February 5, 2010 at 6:00 am #30465peterlaursenParticipant
Looks like you got a friend! 😆
-
February 5, 2010 at 6:30 am #30466khwajaMember
Hi Peter
Yeah i got a gud frnd 😀
I tried with two sample programs. One with odbc and other with .net connector.
I am facing the same problem.It still dispalying as ????.
I feel its a problem with winform but not with database.
Thanks
Khwaja
-
-
AuthorPosts
- You must be logged in to reply to this topic.