-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix Native Digits Support #71045
Fix Native Digits Support #71045
Conversation
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsWe always assumed the native digits always one character. This was the case for NLS. Now in ICU, there are some locales which use native digits expressed as surrogate pairs.
|
CC @eerhardt @maryamariyan if you can help review it. |
Does this affect treatment of |
No |
src/native/libs/System.Globalization.Native/pal_localeStringData.c
Outdated
Show resolved
Hide resolved
src/native/libs/System.Globalization.Native/pal_localeStringData.c
Outdated
Show resolved
Hide resolved
src/native/libs/System.Globalization.Native/pal_localeStringData.c
Outdated
Show resolved
Hide resolved
src/native/libs/System.Globalization.Native/pal_localeStringData.c
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs
Outdated
Show resolved
Hide resolved
@eerhardt @stephentoub do you have any more comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @tarekgh!
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs
Show resolved
Hide resolved
|
||
} while (ffffPos < digits.Length && index < 10); | ||
|
||
Debug.Assert(index >= 10, $"Couldn't read native digits for '{_sWindowsName}' successfully."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be index == 10? result is exactly 10 items long, so if we tried to do result[10], it would have thrown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can do that. I am not sure if this is worth another PR though.
We always assumed the native digits one character. This was the case for NLS. Now in ICU, there are some locales which use native digits expressed as surrogate pairs.
ccp-Cakm-BD
locale is a good example of that which uses the native digits"\U0001E950", "\U0001E951", "\U0001E952", "\U0001E953", "\U0001E954", "\U0001E955", "\U0001E956", "\U0001E957", "\U0001E958", "\U0001E959"
. This change is to allow reading the native digits correctly from ICU.