-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
iOS Numeric Format
setting not respected
#110430
Comments
Numeric Format
setting not respected
This comment has been minimized.
This comment has been minimized.
This sounds like the default CultureInfo isn't instantiated correctly, which is an issue for dotnet/runtime. |
Tagging subscribers to this area: @dotnet/area-system-numerics |
Tagging subscribers to this area: @dotnet/area-system-globalization |
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger |
@matouskozak could you please have a look and triage? |
For the record, this was originally reported here: Note that the user seems to think it is due to the mix of Swedish&English keyboard, introduced in ios18 |
@LiamMorrow Thanks a lot for the great issue description with concrete examples. I'm able to reproduce the issue, on both .net 8 and .net 9 MAUI apps. Do you with which version of .NET it used used to work correctly? Anyways, I'll investigate why the |
Thanks @matouskozak for looking into it!
I have a feeling it has never worked correctly, however iOS 18 has released new keyboards which allow for multi locale keyboards which has probably made it much easier for it to happen. I don't think many users would stray from their default locale's number format otherwise. The user who reported it to me says it started occuring when they switched to the Swedish/English keyboard. |
Description
When using
decimal.Parse
using the defaultCultureInfo
(or not specifying one), MAUI does not respect the user's decimal separator options in iOS. Instead, it simply uses the language's default. What this means is that when a user is prompted for numerical, decimal input, the iOS keyboard presents them with acomma
separator (as they have configured), but decimal.Parse treats it as a grouping separator.Note that if the user specifies a LANGUAGE which uses commas as a decimal separator, everything works as expected and decimal parse treats commas as decimal separators.
Screenshot showing how the default culture parses a decimal, and the correct parsing
Screenshot showing that the keyboard only allows entering decimals with commas
Code driving the parsing logic
Video showing off behaviour
Screen.Recording.2024-12-04.at.12.14.58.mov
Steps to Reproduce
An example repo for parsing can be found here:
https://github.com/LiamMorrow/maui-decimal-repro
Link to public reproduction project repository
https://github.com/LiamMorrow/maui-decimal-repro
Version with bug
9.0.12 SR1.2
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 18
Did you find any workaround?
Cloning the current culture, then using the proper separators in the clone, and setting it as the current culture on app startup does fix this. See this PR for an example.
Relevant log output
The text was updated successfully, but these errors were encountered: