简体   繁体   English

Double.Parse在德语语言环境中失败

[英]Double.Parse fails in german locale

I have a raspberry pi with system language set to "de_DE.UTF-8" and mono version 3.28 installed. 我有一个覆盆子pi,系统语言设置为“de_DE.UTF-8”,单声道版本3.28安装。 My programs need to convert Strings into Doubles , but I ran into a few problems: 我的程序需要将Strings转换为Doubles ,但我遇到了一些问题:

Double.Parse("500", NumberStyles.Float, CultureInfo.InvariantCulture);

Works just fine. 工作得很好。

Double.Parse("500.123", NumberStyles.Float, CultureInfo.InvariantCulture);

Throws FormatException , what is weird. 抛出FormatException ,这FormatException

Double.Parse("500,123", NumberStyles.Float, CultureInfo.GetCultureInfo("de-DE"));

Throws FormatException too; 也抛出FormatException ;

The funny thing is if I change my system language (sudo raspi-config) to "en-GB.UTF-8" all functions work as expected. 有趣的是,如果我将系统语言(sudo raspi-config)更改为“en-GB.UTF-8”,则所有功能都按预期工作。 Anyone knows how to solve this as a German user I would like to use German system settings. 任何人都知道如何解决这个问题作为德国用户我想使用德国系统设置。

该错误在单声道3.4中修复,尚未上传到raspberry repo中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM