Bug #25614 After connection is closed, and opened again UTF-8 characters are not read well
Submitted: 14 Jan 2007 17:11 Modified: 23 Jan 2007 15:34
Reporter: Tomislav Ivancic Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.8 (RC) OS:Microsoft Windows (windows xp sp2)
Assigned to: CPU Architecture:Any
Tags: Close(), Connection, Connector/Net, UTF-8

[14 Jan 2007 17:11] Tomislav Ivancic
Description:
Tested on:
MySql version: 5.0.24
Connector/Net 1.0.8 (RC)
.Net 2.0
Windows XP SP2

When connection to the database is closed and opened again, or closed and new connection is opened UTF-8 characters are not read well.
This problem does not exist on Connector/Net 1.0.7 or Connector/Net 5.0.3 only on Connector/Net 1.0.8 (RC).

How to repeat:
string conString = "Database=test; Data Source=localhost;" +
"User Id=root;Password=;CharSet=utf8";
MySqlConnection con = new MySqlConnection(conString);
con.Open();

//Works:
MessageBox.Show(new MySqlCommand("SELECT value FROM table1 WHERE id = 1", con).ExecuteScalar().ToString());

con.Close();
con.Open();

//Does not work:
MessageBox.Show(new MySqlCommand("SELECT value FROM table1 WHERE id = 1", con).ExecuteScalar().ToString());

con.Close();

MySqlConnection con2 = new MySqlConnection(conString);
con2.Open();

//Does not work:
MessageBox.Show(new MySqlCommand("SELECT value FROM table1 WHERE id = 1", con2).ExecuteScalar().ToString());
con2.Close();
[15 Jan 2007 16:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/18125
[15 Jan 2007 16:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/18130
[15 Jan 2007 17:00] Reggie Burnett
Fixed in 1.0.9 and 5.0.4
[23 Jan 2007 15:34] MC Brown
A note has been added to the 1.0.9 and 5.0.4 changelogs.