Bug #8228 turkish character set causing the error
Submitted: 1 Feb 2005 1:40 Modified: 23 Jun 2005 17:20
Reporter: akin demirtug Email Updates:
Status: Closed
Category:Connector/Net Severity:S2 (Serious)
Version:MySQL 4.1+ OS:Microsoft Windows (Windows 2003 Enterprise)
Assigned to: Reggie Burnett Target Version:

[1 Feb 2005 1:40] akin demirtug
Description:
please consider the following lines;

(function GetOrdinal)
for (int i=0; i < fields.Length; i ++)
{
	if (fields[i].ColumnName.ToLower().Equals(name.ToLower()))
	return i;
}
// Throw an exception if the ordinal cannot be found.
	throw new IndexOutOfRangeException("Could not find specified column in results");

(function configure)
cmd.CommandText = "SET NAMES " + charSet + "; SET character_set_results=NULL";

(function LoadCharacterSets)
charSets[ Convert.ToInt32(reader["id"]) ] = reader["charset"];

function configure sets names in "latin5" so the server returns results in "latin5", and
function GetOrdinal() tries to Compare to value "id" against the value "Id" but be warn
before the comparing, all strings converted to lower case and i can say; in turkish
alphabet char 'I' and 'i' aren't same unlike the English alphabet, they are two different
characters, in this statement, the driver try to compare "id" against &#305;d" so the
exception is inevitable

Note: Consider the following characters

char in UPPERCASE -> 'I', in lowercase -> '&#305;'
char in UPPERCASE -> '&#304;', in lowercase -> 'i' 

How to repeat:
in order to get the error, install MySQL 4.1 or later, change your Regional settings to
Turkey and Turkish and try to connect MySql Database than get the error "Could not find
specified column in results", you can try to force change the character set to "latin5"
manually by setting the

string charSet = connectionString.CharacterSet;

line to

string charSet = "latin5"; //connectionString.CharacterSet;

in function configure()

Suggested fix:
do not retrieve server variables in user defined character set, always use latin1, but
there is something strange, you can manually override that setting to "always use latin1"
but when you override the setting, connection remains close and new exception generates
"Connection must be valid and open", but you can still override the settings in
CheckState function to force to open connection when the connection isn't open
[31 May 2005 16:03] [ name withheld ]
I keep getting this exception no matter what i tryied; setting charset=latin1 in
connection string, changing my regional settings to us... no luck!
[22 Jun 2005 13:22] [ name withheld ]
I am getting this problem too, changing regional settings, modifyin source to
charSet="latin1" etc didnt work. Its been months Reggie, were you busy?
[22 Jun 2005 20:53] 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
[23 Jun 2005 17:20] Mike Hillyer
Documented in 1.0.5 changelog: 

<para>Fixed a bug where Connector/NET could not work properly with certain regional
settings. (WL#8228)</para>
[8 Aug 2005 18:49] Basar Akyelli
I still cannot use MySql on my computer because of this problem. Could you please and
please advise me a way out? I am OK to change my regional settings (which did not work.)