neuecc / Utf8Json

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

Make Infinity and NaN (de)serialization Culture independent #102

Open epeshk opened 6 years ago

epeshk commented 6 years ago

double.PositiveInfinity, NaN string representations depends on culture settings. E.g. PositiveInfinity can be "Infinity", "∞", "бесконечность" and so on. Therefore, current code in StringToDoubleConverter may fail on Infinity and NaN deserialization.

In this PR I use InvariantCulture ToString conversion for double.NaN and double.PositiveInfinity to avoid it.

epeshk commented 6 years ago

Updated PR: