Skip to content

Commit bfd12af

Browse files
committed
Don't use Turkish casing for en-US-POSIX.
Previously, we were using a comparision between "i" and "I" (while ignoring case) to figure out if we needed to do Turkish casing (on the assumption that locales which compared i and I as non equal when ignoring case were doing Turkish casing). ICU Does tailoring of the en-US-POSIX locale and assigns different primary wights to 'i' and 'I'. You can see this in the ICU Collation Demo by looking at the raw collation elements. Different primary weights mean they different letters, not the same letter with a difference in casing (which is a trinary weight). This changes the check to compare using an actual Turkish i when doing our detection to not get confused by these cases. Fixes #2531
1 parent e8d94bc commit bfd12af

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ private unsafe char ChangeCase(char c, bool toUpper)
8888
private bool NeedsTurkishCasing(string localeName)
8989
{
9090
Contract.Assert(localeName != null);
91-
return CultureInfo.GetCultureInfo(localeName).CompareInfo.Compare("i", "I", CompareOptions.IgnoreCase) != 0;
91+
92+
return CultureInfo.GetCultureInfo(localeName).CompareInfo.Compare("\u0131", "I", CompareOptions.IgnoreCase) == 0;
9293
}
9394

9495
private bool IsInvariant { get { return m_cultureName.Length == 0; } }

0 commit comments

Comments
 (0)