Open cyberphone opened 8 years ago
Neither of those links tell me anything. Where is the ES6 number specification? And give an example of a number that is wrong and what the correct number is.
@JamesNK Here is the number specification: 7.1.12.1 in http://www.ecma-international.org/ecma-262/6.0/ECMA-262.pdf
I don't have a JSON.net example but double.toString() wasn't designed for ES6 compatibility so the difference in formatting is likely to be rather big.
Double d = 0.00005;
Console.Write(d);
The above returns 5E-05 while ES6 mandates 0.00005
I'll wait until MS fixes this in DCJS and then reuse it
@JamesNK Sounds like a reasonable solution. I just hope it won't take forever :-)
Now it is available: https://github.com/cyberphone/json-canonicalization/tree/master/dotnet/es6numberserialization
Finally making clear text signatures using Json.NET fully realistic! https://github.com/cyberphone/json-canonicalization/tree/master/dotnet/json.net.sign#clear-text-signature-sample-solution
Unfortunately there is a bug in .NET with respect to parsing floating point numbers: https://github.com/dotnet/coreclr/issues/17467
After looking into the code it seems that numbers do not follow ES6. This is usually not a problem but there's a new use-case which may motivate an update:
https://github.com/Microsoft/ChakraCore/issues/149
Unfortunately this is an non-trivial thing: https://github.com/cyberphone/openkeystore/blob/master/library/src/org/webpki/json/JSONObjectWriter.java#L147