Bug #6541 Charset-map for UCS-2
Submitted: 10 Nov 2004 9:12 Modified: 15 Nov 2004 16:33
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version: OS:
Assigned to: Reggie Burnett CPU Architecture:Any

[10 Nov 2004 9:12] [ name withheld ]
Description:
In CharSetMap.cs,  encoding name for UCS-2 is mapped as:

  mapping.Add( "uc2", "uc-2" );

It should be:

  mapping.Add( "ucs2", "UTF-16BE" );

The encoding name "ucs-2" (or "UTF-16LE") does not work correctly.
MySqlDataReader.GetString returns corrupted string.

I'm using mysql-connector-net-1.0.1-beta and  MySQL 4.1.7.

How to repeat:
CREATE DATABASE db CHARACTER SET ucs2
CREATE TABLE tbl (text CHAR(30))
INSERT INTO tbl VALUES ('****') 

and read values.

MySqlConnection conn = new MySqlConnection("Database=db");
conn.Open();
MySqlCommand cmd = new MySqlCommand("SELECT * FROM tbl", conn);
MySqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
   string s = reader.GetString(0);
}
reader.Close();
conn.Close();
[15 Nov 2004 16:33] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

I can verify this problem but it's a bigger problem than that.