Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double.Parse fails in german locale

Tags:

c#

mono

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.

like image 883
user3469517 Avatar asked Apr 05 '14 12:04

user3469517


1 Answers

The bug is fixed in mono 3.4 which is not yet uploaded in raspberry repo

like image 150
user3469517 Avatar answered Oct 12 '22 23:10

user3469517