neuecc / Utf8Json

Definitely Fastest and Zero Allocation JSON Serializer for C#(NET, .NET Core, Unity, Xamarin).
MIT License
2.35k stars 266 forks source link

Culture problem? #158

Open sebas77 opened 5 years ago

sebas77 commented 5 years ago

this line

static readonly byte[] nansymbol = StringEncoding.UTF8.GetBytes(double.NaN.ToString());

returns a byte array of size 0 when Czech culture is used. It probably fails with other culture as well.

This would fix it:

static readonly byte[] nansymbol = StringEncoding.UTF8.GetBytes(NumberFormatInfo.InvariantInfo.NaNSymbol);

no clue if it's a good fix. I don't even understand why this byte array is used in the way is used so...