Bug 52319 - Stepper double conversion is not Cultureaware
Summary: Stepper double conversion is not Cultureaware
Status: RESOLVED DUPLICATE of bug 36417
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-06 15:15 UTC by Jesper Jensen
Modified: 2017-03-24 17:45 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 36417

Description Jesper Jensen 2017-02-06 15:15:08 UTC
When using the Stepper on a Danish region Phone, i am unable to use comma in my entry fields.

I want to enter "1,8" but it is converted to "18".

I believe the root cause, is the way Stepper converts to Double
Taken from the source at GitHub:

coerceValue: (bindable, value) =>
		{
			var stepper = (Stepper)bindable;
			stepper.Value = stepper.Value.Clamp(stepper.Minimum, (double)value);
			return value;
		});

I Believe the Conversion should be CultureAware, like the Convert.ToDouble() method:
Convert.ToDouble Method (String, IFormatProvider)

https://msdn.microsoft.com/en-us/library/9s9ak971(v=vs.110).aspx
Comment 1 Jesper Jensen 2017-02-07 07:40:23 UTC
More testing done on my part.

My Bug report is wrong, The code i mention is not the culprit.
The Issue remains thou.

Somewhere in Xamarin Binding, there is a Culture-unaware parsing of doubles, that causes Comma to be removed.

Two test cases i made:

string input = "1,9";
double output = double.Parse(input);
Assert.AreEqual(19D, output);

string input = "1,9";
double output = double.Parse(input, new CultureInfo("da-DK"));
Assert.AreEqual(1.9D, output);
Comment 2 Jimmy [MSFT] 2017-03-24 17:45:25 UTC
This appears to be expected behavior per bug 36417.

Since this would be a feature change in Forms, it would be best suited as a proposal in our Evolution forum[1] for future consideration. When submitting a proposal on the Evolution forum, be sure to first read the contribution guidelines[2] so your proposal is ready for discussion with the Forms team and community. Thanks!

[1] https://forums.xamarin.com/categories/xamarin-forms-evolution
[2] https://forums.xamarin.com/discussion/84503/please-read-first

*** This bug has been marked as a duplicate of bug 36417 ***