summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Meier <roger@apache.org>2011-07-28 18:35:51 +0000
committerRoger Meier <roger@apache.org>2011-07-28 18:35:51 +0000
commit3da317bda100130b2f615034c46b0944888f0f14 (patch)
tree2478b3e09ffe0ba04009d588a2a1a2ecce8dcf91
parentd2f8da4bb8d0c48bbbc0bf0cbe97b3dc1c84188c (diff)
downloadthrift-3da317bda100130b2f615034c46b0944888f0f14.tar.gz
THRIFT-1245 C# JSON Protocol uses culture-dependant decimal separator for double
Patch: Nacim Rahal git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1151959 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--lib/csharp/src/Protocol/TJSONProtocol.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/csharp/src/Protocol/TJSONProtocol.cs b/lib/csharp/src/Protocol/TJSONProtocol.cs
index 5f6351f7e..a35fcd39d 100644
--- a/lib/csharp/src/Protocol/TJSONProtocol.cs
+++ b/lib/csharp/src/Protocol/TJSONProtocol.cs
@@ -23,6 +23,7 @@ using System.Text;
using System.Collections.Generic;
using Thrift.Transport;
+using System.Globalization;
namespace Thrift.Protocol
{
@@ -503,7 +504,7 @@ namespace Thrift.Protocol
private void WriteJSONDouble(double num)
{
context.Write();
- String str = num.ToString();
+ String str = num.ToString(CultureInfo.InvariantCulture);
bool special = false;
switch (str[0])
@@ -840,7 +841,7 @@ namespace Thrift.Protocol
if (reader.Peek() == QUOTE[0])
{
byte[] arr = ReadJSONString(true);
- double dub = Double.Parse(utf8Encoding.GetString(arr));
+ double dub = Double.Parse(utf8Encoding.GetString(arr), CultureInfo.InvariantCulture);
if (!context.EscapeNumbers() && !Double.IsNaN(dub) &&
!Double.IsInfinity(dub))