Bug #50933 6.2.2 support partially on UTF-8 only ?

Submitted: 5 Feb 2010 0:40 Modified: 5 Feb 2010 17:29
Reporter: cai koh Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.2.2 OS:Windows
Assigned to: CPU Architecture:Any
Tags: NET, UTF-8, vb2008

[5 Feb 2010 0:40] cai koh
Description:
If I use SQL insert into mysql admin page, the SQL command
as follows : 

CREATE TABLE IF NOT EXISTS `Category` ( `Categorycode` varchar( 50) COLLATE
utf8_unicode_ci NOT NULL, `Desc1` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc2`
varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc3` varchar( 50) COLLATE
utf8_unicode_ci NOT NULL, `Desc4` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `ISN`
varchar( 20) COLLATE utf8_unicode_ci NOT NULL, `Ordering` varchar( 10) COLLATE
utf8_unicode_ci NOT NULL, `StockNotes` varchar( 200) COLLATE utf8_unicode_ci NOT NULL,
`Worth` float NOT NULL , `LastLog` varchar( 20) COLLATE utf8_unicode_ci NOT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `Category` (
`Categorycode`, `Desc1`, `Desc2`, `Desc3`, `Desc4`, `ISN`, `Ordering`, `StockNotes`,
`Worth`, `LastLog`) VALUES ( 'try1cat', 'BAMBOO CAN  竹筒', '-', '-', '-', '-', '-',
'-', 0, '-')"

The chinese charaxter  '竹筒' displayed.

But if I download mySQL Net Connector (I tried with 5.0, 5.2, 6.2.2) and start a project with VB2008, add reference for MYSQL Net Connector 6.2.2 dll and execute the same sql using : 

        Dim i As Integer
        Dim cmd As New MySqlCommand
        cmd.CommandText = sqlstr
        cmd.CommandType = Data.CommandType.Text
        cmd.Connection = New MySqlConnection(connectionString)
        cmd.Connection.Open()
        i = cmd.ExecuteNonQuery()

The chinese character appears as ??

How to repeat:
Create a database, start vs2010, create a new project, add new reference for 6.2.2 dll 

dim connectionstring = "......"

dim sqlstr = _
CREATE TABLE IF NOT EXISTS `Category` ( `Categorycode` varchar( 50) COLLATE
utf8_unicode_ci NOT NULL, `Desc1` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc2`
varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc3` varchar( 50) COLLATE
utf8_unicode_ci NOT NULL, `Desc4` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `ISN`
varchar( 20) COLLATE utf8_unicode_ci NOT NULL, `Ordering` varchar( 10) COLLATE
utf8_unicode_ci NOT NULL, `StockNotes` varchar( 200) COLLATE utf8_unicode_ci NOT NULL,
`Worth` float NOT NULL , `LastLog` varchar( 20) COLLATE utf8_unicode_ci NOT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `Category` (
`Categorycode`, `Desc1`, `Desc2`, `Desc3`, `Desc4`, `ISN`, `Ordering`, `StockNotes`,
`Worth`, `LastLog`) VALUES ( 'try1cat', 'BAMBOO CAN  竹筒', '-', '-', '-', '-', '-',
'-', 0, '-')"
       Dim i As Integer
        Dim cmd As New MySqlCommand
        cmd.CommandText = sqlstr
        cmd.CommandType = Data.CommandType.Text
        cmd.Connection = New MySqlConnection(connectionString)
        cmd.Connection.Open()
        i = cmd.ExecuteNonQuery()

Suggested fix:
amend the 6.2.2 source to handle the sent in utf-8 characters
[5 Feb 2010 6:00] Peter Laursen
similar report here:
http://bugs.mysql.com/bug.php?id=50868
[5 Feb 2010 10:36] cai koh
I Found the solution, in the connection string , amend to include Character Set = utf8 
        string MySqlString = "User Id=dis;pwd=sa;Host=1.2.3.4;Port=6033;Database=dis;Character Set=utf8";

Thank you very much!!
[5 Feb 2010 17:29] Tonci Grgin
Cai, the native charset for almost all of our connectors *is* UTF-8. Bear that in mind if you end up in problems in the future.

Glad problem is solved, closing the report now.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.