| Bug #25385 | Problems with accents in .NET DataTable column name | ||
|---|---|---|---|
| Submitted: | 3 Jan 2007 13:01 | Modified: | 17 Oct 2007 19:43 |
| Reporter: | Gilles TOURREAU | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 5.0.2 | OS: | Windows (WinXP) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | .NET; 2.0; DataTable; accent; column name; | ||
[3 Jan 2007 13:01]
Gilles TOURREAU
[8 Jan 2007 21:55]
Reggie Burnett
Gilles Are you using an appropriate character set? You should remember that unless you set a character set, the symbols that come back will be in the default character set which may be latin1. Add something like "char set = utf8" to your connection string and try again. Thanks
[9 Jan 2007 14:09]
Gilles TOURREAU
I try it in my connection string : Server=myHost;Database=myDataBase;User Id=MyUser;Password=MyPass;Character Set=utf8 and Server=myHost;Database=myDataBase;User Id=MyUser;Password=MyPass;Character Set=latin1 And i have the same problem...
[15 Jan 2007 10:26]
Tonci Grgin
Hi Gilles. This is actually duplicate of Bug#23657 which is closed but I see the same behavior with today c/NET 5 sources. I am referring to my test case provided in Bug#23657: - Inspecting "objDT.Columns(0).ColumnName" gives wrong value for column name (wrong accents) - Displaying column name in label with EE font (cp 1250) gives correct result (correct accents displayed) - Displaying column name in label with generic font set to EE script (cp 1250) gives wrong result (displays wrong accents)
[26 Jan 2007 18:35]
Reggie Burnett
I am still unable to reproduce this. I'm using the following as a test case and it passes.
[Test]
public void Test1()
{
using (MySqlConnection c = new MySqlConnection(GetConnectionString(true) + ";charset=utf8"))
{
c.Open();
MySqlCommand cmd = new MySqlCommand("CREATE TABLE test (Modèle int)", c);
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO test VALUES (1)";
cmd.ExecuteNonQuery();
MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", c);
DataTable dt = new DataTable();
da.Fill(dt);
Assert.AreEqual(1, dt.Columns.Count);
Assert.AreEqual(1, dt.Rows.Count);
Assert.AreEqual("Modèle", dt.Columns[0].ColumnName);
}
}
[30 Jan 2007 14:48]
Tonci Grgin
Gilles, what does Reggies test case say on your machine?
[30 Jan 2007 17:14]
Gilles TOURREAU
I have an assertion fail at :
Assert.AreEqual("Modèle", dt.Columns[0].ColumnName);
If I replace this line with :
System.Diagnostics.Debug.WriteLine(dt.Columns[0].ColumnName);
The output result is :
Modèle
[31 Jan 2007 17:54]
Reggie Burnett
I can't do anything with this currently. I still do not have any repeatable test case that shows this problem. I believe there is a problem *somewhere* because you and Tonci both see it but until it fails on my machine I can't fix it.
[11 Jun 2007 8:36]
Tonci Grgin
Bug#28328 has been marked as duplicate of this one.
[11 Jun 2007 8:55]
Tonci Grgin
This could very well be due to server settings. I have managed to get correct results by putting:
cmd.CommandText = "SET character_set_results=latin1";
cmd.ExecuteNonQuery();
in code as I noticed
3 Query SET NAMES utf8;SET character_set_results=NULL
in general query log.
Environment:
- MySQL server 5.0.44BK on WinXP Pro SP localhost
- NET FW 2.0 with c/NET 5.1.2 and 5.0.7
I think this should be closed as !Bg, Reggie?
[17 Oct 2007 19:43]
Reggie Burnett
This is a duplicate of 31185 which has been fixed in 5.1.4 and 5.0.9
