The bug is fixed in mono 3.4 which is not yet uploaded in raspberry repo
Double.Parse fails in german locale
Question
I have a raspberry pi with system language set to "de_DE.UTF-8" and mono version 3.28 installed. My programs need to convert Strings
into Doubles
, but I ran into a few problems:
Double.Parse("500", NumberStyles.Float, CultureInfo.InvariantCulture);
Works just fine.
Double.Parse("500.123", NumberStyles.Float, CultureInfo.InvariantCulture);
Throws FormatException
, what is weird.
Double.Parse("500,123", NumberStyles.Float, CultureInfo.GetCultureInfo("de-DE"));
Throws FormatException
too;
The funny thing is if I change my system language (sudo raspi-config) to "en-GB.UTF-8" all functions work as expected. Anyone knows how to solve this as a German user I would like to use German system settings.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow