You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2011/07/28 20:35:51 UTC

svn commit: r1151959 - /thrift/trunk/lib/csharp/src/Protocol/TJSONProtocol.cs

Author: roger
Date: Thu Jul 28 18:35:51 2011
New Revision: 1151959

URL: http://svn.apache.org/viewvc?rev=1151959&view=rev
Log:
THRIFT-1245 C# JSON Protocol uses culture-dependant decimal separator for double
Patch: Nacim Rahal

Modified:
    thrift/trunk/lib/csharp/src/Protocol/TJSONProtocol.cs

Modified: thrift/trunk/lib/csharp/src/Protocol/TJSONProtocol.cs
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/csharp/src/Protocol/TJSONProtocol.cs?rev=1151959&r1=1151958&r2=1151959&view=diff
==============================================================================
--- thrift/trunk/lib/csharp/src/Protocol/TJSONProtocol.cs (original)
+++ thrift/trunk/lib/csharp/src/Protocol/TJSONProtocol.cs Thu Jul 28 18:35:51 2011
@@ -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))