From 3da317bda100130b2f615034c46b0944888f0f14 Mon Sep 17 00:00:00 2001 From: Roger Meier Date: Thu, 28 Jul 2011 18:35:51 +0000 Subject: [PATCH] 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 --- lib/csharp/src/Protocol/TJSONProtocol.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/csharp/src/Protocol/TJSONProtocol.cs b/lib/csharp/src/Protocol/TJSONProtocol.cs index 5f6351f7..a35fcd39 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)) -- 2.17.1