Skip to content

Commit d953401

Browse files
committed
fix culture parsing
1 parent 72fd139 commit d953401

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/JsonLD/Core/RDFDataset.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using JsonLD.Core;
45
using Newtonsoft.Json.Linq;
56

@@ -220,7 +221,7 @@ internal virtual JObject ToObject(bool useNativeTypes)
220221
{
221222
try
222223
{
223-
double d = double.Parse(value);
224+
double d = double.Parse(value, CultureInfo.InvariantCulture);
224225
if (!double.IsNaN(d) && !double.IsInfinity(d))
225226
{
226227
if (JSONLDConsts.XsdInteger.Equals(type))
@@ -746,7 +747,7 @@ private RDFDataset.Node ObjectToRDF(JToken item)
746747
value = new JValue((double)number);
747748
}
748749
// canonical double representation
749-
return new RDFDataset.Literal(string.Format("{0:0.0###############E0}", (double)value), datatype.IsNull() ? JSONLDConsts.XsdDouble
750+
return new RDFDataset.Literal(string.Format(CultureInfo.InvariantCulture, "{0:0.0###############E0}", (double)value), datatype.IsNull() ? JSONLDConsts.XsdDouble
750751
: (string)datatype, null);
751752
}
752753
else

0 commit comments

Comments
 (0)