Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CultureAwareCompare breaks driver in some languages [DNET167] #175

Closed
firebird-automations opened this issue Jun 16, 2008 · 8 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: Jan Persson (jpersson)

Is related to DNET166

We are using Firebird embedded together with NHibernate for of our product.

One of our Turkish customers had a problem starting our server and after some investigation I've found that the culprit was the method GetOrdinal in FbDataReader.cs. You are using a CultureAwareCompare when you compare the available column names with the column that the caller want to retrieve, but that does not work when the machine is set to have Regional Options as Turkish and I believe other languages will have similar problems for certain column names.

The snippet looks like this:

for (int i = 0; i < this.fields.Count; i++)
{
if (GlobalizationHelper.CultureAwareCompare(name, this.fields[i].Alias))
{
return i;
}
}

But it only works if I change it to do an ordinary string compare.

for (int i = 0; i < this.fields.Count; i++)
{
if (name.ToLowerInvariant() == this.fields[i].Alias.ToLowerInvariant())
{
return i;
}
}

Commits: d760d96

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Can you send me some turkish string? Because we're doing compare with this options:
CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase
which I don't know what it does with this string. Using ToLowerInvariant isn't good choice, because you can have columns named with some "weird" characters and that can cause problems.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue is related to DNET166 [ DNET166 ]

@firebird-automations
Copy link
Author

Commented by: Jan Persson (jpersson)

The strange thing is that there's nothing specific Turkish about the strings that fails. At least AFAIK. I don't know Turkish.

In my case it fails when GetOrdinal is called like this:

GetOrdinal("setting1_20_0_");

It then fails to compare it with the real name of the database column, which is

"SETTING1\_20\_0\_"

This is really easy to reproduce. In "Regional and Language Options" (Control Panel) just change "Standards and Formats" to Turkish and "Location" to Turkey and it will fail if you have a database with a column named "SETTING1_20_0_".

@firebird-automations
Copy link
Author

Commented by: @cincuranet

The problem is, that in turkish is also "big i with dot" (try string s = "settings".ToUpper(new CultureInfo("tr-TR"));).

Adding there invariant culture can then break functionality when somebody is using culture specific behavior. I have to look how this behaves in ms sql client.

@firebird-automations
Copy link
Author

Commented by: @cincuranet

rev.608

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5.0. Alpha 3 [ 10261 ]

Fix Version: 2.5.0 [ 10170 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Fix Version: 2.5.0 [ 10170 ] =>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants