Windows Phone Regional Issues

I have a text file that needs to be parsed in an application, and this has been tested on my device in the UK and on a device in the USA. The same text file is used by Android and iPhone applications that work fine. I was informed that some people on Windows phones do not work!

It turns out that if the device is configured for a region such as Germany, which uses the comma "," as a decimal point, the following code does not work properly!

GeoCoordinate tempCoord = new GeoCoordinate();
tempCoord.Latitude = Convert.ToDouble(words[0]);
tempCoord.Longitude = Convert.ToDouble(words[1]);

As the words enter the string, I'm not sure how else can I get this double from the string?

EDIT: On a slightly related note, the following makes me sad!

geoWatcher.Position.Location.Latitude.ToString()

This will return 56,888 euros and 56,888 for the US / UK!

Arrrgh!

+3
1

Convert.ToDouble double.parse(...):

double d = double.Parse("3.500,02", CultureInfo.GetCultureInfo("de-DE").NumberFormat); 

double.ToString(), , double .

+1

Source: https://habr.com/ru/post/1787167/


All Articles