Why is it difficult to manage?
In normal cases, String comparison is not an issue. However the issue arises while using culturally sensitive routines in places. It is difficult to manage string comparison where multiple culture is used in one project.
In Turkish culture, for most Latin alphabets, the letter i (Unicode 0069) is the lowercase version of I (Unicode 0049). The Turkish alphabet, however, has two versions of the letter I, one with a dot and one without.
English culture1 – i (u0069) < - > Turkish – i(u0130)
English culture1 – i (u0069) < - > English – I(u0049)
English culture1 – I (u0049) < - > Turkish – I(u0131)
Here is some code that demonstrates what this mean:
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Console.WriteLine("Culture = {0}", Thread.CurrentThread.CurrentCulture.DisplayName);
Console.WriteLine("(file == FILE) = {0}", (string.Compare("file", "FILE", true) == 0));
Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR");
Console.WriteLine("Culture = {0}",Thread.CurrentThread.CurrentCulture.DisplayName);
Console.WriteLine("(file == FILE) = {0}", (string.Compare("file", "FILE", true) == 0));
//Output:
//Culture = English (United States)
//(file == FILE) = True
//Culture = Turkish (Turkey)
//(file == FILE) = False
Here, solution and recommendation is to use ‘InvariantCulture’ if developer knows the criteria of the application, whether it includes different cultures or not.