Skip to content

Commit 2109a71

Browse files
authored
Merge pull request #30 from brean/FixGlobalizationDot
Bugfix to support floating point numbers internationally (fixes #28)
2 parents 80c2828 + bf43a19 commit 2109a71

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

JSONObject.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System.Collections;
1212
using System.Collections.Generic;
1313
using System.Text;
14+
using System.Globalization;
1415
/*
1516
Copyright (c) 2015 Matt Schoen
1617
@@ -352,9 +353,9 @@ void Parse(string str, int maxDepth = -2, bool storeExcessLevels = false, bool s
352353
default:
353354
try {
354355
#if USEFLOAT
355-
n = System.Convert.ToSingle(str);
356+
n = System.Convert.ToSingle(str, CultureInfo.InvariantCulture);
356357
#else
357-
n = System.Convert.ToDouble(str);
358+
n = System.Convert.ToDouble(str, CultureInfo.InvariantCulture);
358359
#endif
359360
if(!str.Contains(".")) {
360361
i = System.Convert.ToInt64(str);

0 commit comments

Comments
 (0)