Fix Turkish casing on Android by deriving it from the locale name - #132001
Closed
MsfPablo wants to merge 1 commit into
Closed
Fix Turkish casing on Android by deriving it from the locale name#132001MsfPablo wants to merge 1 commit into
MsfPablo wants to merge 1 commit into
Conversation
TextInfo.NeedsTurkishCasing detected the Turkish dotted/dotless i casing rules by probing whether the culture collates U+0131 equal to 'I' under IgnoreCase. On Android the system ICU does not provide the collation data that probe depends on, so the check returned false for tr-TR and casing silently fell back to the non-Turkish path, making i.ToUpper() yield 'I' instead of U+0130. Fixes dotnet#106560
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-globalization |
Author
|
Closing as duplicate — superseded by #132002, which includes the same fix plus the regression test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #106560
Root cause
TextInfo.NeedsTurkishCasing(src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.Icu.cs) decides whether to useChangeCaseTurkishby probing collation:On Android the runtime loads the platform's system ICU (
libicuuc.so/libicui18n.so), which does not provide the collation tailoring this probe depends on. The probe therefore returnsfalsefortr-TR,IcuChangeCasefalls through to the non-TurkishChangeCase, and"i".ToUpper(tr-TR)yieldsI(U+0049) rather thanİ(U+0130).The same collation gap is already acknowledged in the test suite, which skips the
'ı'vs'I'CurrentCultureIgnoreCasecases on Android with a pointer to this issue (src/libraries/System.Runtime/tests/System.Runtime.Tests/System/CharTests.cs:178).Fix
Derive the flag from the locale's language subtag instead. ICU itself applies the dotted/dotless i rules to exactly the
trandazlanguages (ucase.cpptreats both asLOC_TURKISH), so this is equivalent to the collation probe on platforms where the probe worked, while being independent of the collation data actually shipped by the host.Testing
Not verified on a device — I do not have an Android emulator/runtime build available here, so this is based on source analysis. Casing behaviour on other platforms should be unchanged, since
tr/azare the only languages for which CLDR collates U+0131 equal toIunderIgnoreCase. The disabled casing assertions referencing #106560 would be the natural way to validate this on CI; I left them untouched, as theCompare-based assertions inCharTestsexercise collation rather than casing and are not fixed by this change.Note: @murathanoktem mentioned on the issue that they were investigating. Happy to close this in favour of their PR — I am posting it because I had the root cause isolated.