
In Turkish, the lowercase of “I” is “ı” and the uppercase of “i” is “İ”. Culture-sensitive ToLower(), ToUpper() or case-insensitive comparisons turn “FILE” into “fıle” in a tr-TR environment, and “[email protected]” no longer matches “[email protected]”. The fix is to use culture-independent (ordinal/invariant) comparisons for identifiers, keys, e-mail addresses and protocol strings, and to choose the database collation deliberately.
Symptoms: “Invalid column name”, unmatched e-mails, broken search
- An application that works perfectly on the developer’s machine behaves differently on a server or client whose regional setting is Turkish.
- A user who types their e-mail address in capitals cannot log in and gets a “user not found” error.
- Searching for “istanbul” does not return records stored as “ISTANBUL”.
- Configuration keys or enum values such as “File”, “Id” or “Info” are not recognised.
- In a SQL Server database with a Turkish collation, a query fails with: “Msg 207, Level 16: Invalid column name ’musteriid’.” or “Msg 208: Invalid object name ’dbo.MUSTERI’.”
- The same query runs without error on the developer’s test database, which uses an English collation.
Root cause: Turkish has four different “i” letters
In most languages that use the Latin alphabet, “i” (U+0069) and “I” (U+0049) are the lowercase and uppercase forms of the same letter. Turkish (and Azerbaijani) has two separate pairs instead: “i” with “İ” (U+0130), and “ı” (U+0131) with “I”. The Unicode SpecialCasing.txt file defines this rule explicitly: in Turkish, lowercasing “I” produces the dotless “ı”, and uppercasing “i” produces the dotted “İ”.
Microsoft Learn calls this the “Turkish-I problem” and gives the canonical example: an IsFileURI(“file:”) call written with a case-insensitive but culture-sensitive comparison returns true under an English culture and false under a Turkish culture. According to the documentation, this can even allow someone to bypass a security check that blocks addresses starting with “FILE:” on Turkish systems. The Java documentation gives the same warning: “TITLE”.toLowerCase() returns “tıtle” in a Turkish locale, and Locale.ROOT should be used for programming language identifiers, protocol keys and HTML tags.
On the database side the mechanism is the same. When SQL Server is installed on a server whose operating system locale is Turkish, it selects Turkish_CI_AS as the default collation. According to Microsoft’s documentation, the database collation is used not only for column data but also for all metadata, such as table and column names. “CI” means case-insensitive, but under Turkish rules “i” and “I” are not two forms of the same letter. As a result, under Turkish_CI_AS, N’i’ = N’I’ is false and N’i’ = N’İ’ is true, and referring to a column named MusteriID as “musteriid” produces error 207.
The problem only appears in strings containing the letters “i/I”. Because fields such as “Name” or “Amount” keep working, the error often looks random and inexplicable, which is also why tests tend to miss it.
According to Microsoft’s guide, XML and HTML tags, user names, file paths and the names of system objects are culture-independent data; if they are interpreted as culture-sensitive, subtle bugs, poor performance and, in some cases, security issues follow. The guide also states that the behaviour of the Ordinal comparer never changes, whereas culture-sensitive comparers can change over time with ICU and Windows NLS updates. In other words, a culture-sensitive comparison that passes its tests today may return a different result after a platform update.
Step-by-step fix
- Identify the environment: record the culture of the server and client running the application (CultureInfo.CurrentCulture, or Locale.getDefault() in Java) and the collation of the database.
- Reproduce the problem: run the short tests below under both tr-TR and en-US cultures and compare the results.
- Classify your strings: text shown to users and sorted linguistically (product names, company names) can stay culture-sensitive; identifiers, e-mail addresses, user names, file paths, URL schemes, configuration keys, enum names and protocol values must be handled independently of culture.
- In .NET, compare with StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase, and pass StringComparer.OrdinalIgnoreCase to dictionaries and sets. If you need to normalise, Microsoft recommends ToUpperInvariant rather than ToLowerInvariant.
- In Java, never leave toLowerCase() and toUpperCase() without a parameter; for culture-independent strings use toLowerCase(Locale.ROOT).
- In JavaScript, toUpperCase() and toLowerCase() use Unicode’s default mapping; if you want the Turkish rule, pass the locale explicitly (toLocaleUpperCase(“tr-TR”)), and if you do not, avoid calling the toLocale… methods without a locale, because the result then depends on the browser’s language.
- In SQL Server, write table and column names in your code with exactly the casing used when the object was created. If you do not want the Turkish rule in a specific comparison, specify a different collation in the query with COLLATE.
- After the fix, rerun the tests under the tr-TR culture and against a Turkish_CI_AS database.
// C#: reproducing and fixing the problem
CultureInfo.CurrentCulture = new CultureInfo("tr-TR");
Console.WriteLine("FILE".ToLower()); // fıle
Console.WriteLine("FILE".ToLowerInvariant()); // file
bool same = string.Equals(entered, stored, StringComparison.OrdinalIgnoreCase);
string key = email.Trim().ToUpperInvariant();
var settings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);// Java
"TITLE".toLowerCase(Locale.forLanguageTag("tr")); // tıtle
"TITLE".toLowerCase(Locale.ROOT); // title
// JavaScript
"FILE".toLocaleLowerCase("tr-TR"); // fıle
"istanbul".toLocaleUpperCase("tr-TR"); // İSTANBUL
"file".toUpperCase(); // FILE-- SQL Server: checking collation and behaviour (read-only)
SELECT SERVERPROPERTY('Collation') AS ServerCollation,
DATABASEPROPERTYEX(DB_NAME(), 'Collation') AS DatabaseCollation;
SELECT CASE WHEN N'i' = N'I' COLLATE Turkish_CI_AS THEN 'equal' ELSE 'different' END; -- different
SELECT CASE WHEN N'i' = N'İ' COLLATE Turkish_CI_AS THEN 'equal' ELSE 'different' END; -- equal
-- Bypassing the Turkish rule for a single comparison
SELECT * FROM dbo.Musteri
WHERE Eposta = @email COLLATE Latin1_General_100_CI_AS;Changing the database collation with ALTER DATABASE does not change the collation of existing columns; Microsoft states this explicitly. In databases belonging to packaged software such as ERP systems, do not change the collation without the vendor’s support.
Permanent prevention
- Store e-mail addresses and user names in a separate column, normalised in a culture-independent way at registration time (for example with ToUpperInvariant), and use only that column for search and login.
- Enable code analysis rules CA1307, CA1309 and CA1310 in .NET projects; Microsoft states that these rules find culture-sensitive comparisons used unintentionally.
- In Java projects, ban parameterless toLowerCase() and toUpperCase() calls in code review.
- Run your unit tests at least once under the tr-TR culture, and add test data containing I, such as “FILE”, “Id” or “ISMAIL”.
- Do not leave the collation of new databases at the installation default; choose it deliberately for the application’s needs and document it.
- In SQL scripts, always write object names exactly as they were created; if you use an ORM, define the name mapping explicitly.
When should you call in an expert?
If the problem affects critical flows in a live ERP system or customer portal, such as login, invoice matching or integrations, if you are considering a collation change or bulk data normalisation, or if your access to the source code is limited, expert support is the safer route. For this kind of problem, which we encounter in the field at businesses in Denizli, Workas provides support as part of its custom software development service, planning code review, test scenarios and the database-side fix together.
Frequently Asked Questions
Does setting the application’s culture to en-US solve the problem?
It hides the symptom but is not a permanent fix; dates, numbers and sorting that should appear in Turkish break as well. The correct approach is to make only identifier and key comparisons ordinal/invariant.
Why is ToUpperInvariant recommended over ToLowerInvariant?
Microsoft’s .NET string comparison guide recommends ToUpperInvariant when normalising strings for comparison. Where possible, a direct OrdinalIgnoreCase comparison is preferable to normalising at all.
Is using the Turkish_CI_AS collation wrong?
No. It is needed to sort Turkish text correctly. The problem arises when this collation is also applied to language-independent strings such as identifiers and keys, and when object names in code are written with different casing.
Does the problem only occur on Windows?
No. .NET, Java and JavaScript apply the same Turkish casing rules on all platforms; whenever the culture or locale is Turkish, the problem appears regardless of the operating system.


