fix(decode): use invariant culture for decimal strings - #245
Conversation
|
Is there a test case with a negative number? |
Didn't know that :-). Have changed the test to use negative number and bigger then 1000 for the 1000 separator and test it with different cultures. |
|
One question. I just read the documenation of the easybuild.commitlinter and easybuild.changeloggen. Should I squash the two commits and force-push so that the changelog is clean? |
You don't need to do that because when accepting the PR I am squashing everything instead of merging. |
Summary
This fixes decimal decoding from JSON strings when the current process culture uses a comma decimal separator.
Decode.decimalwas using the current culture for string parsing, which meant values like"0.7833"could fail under cultures such asde-DEeven though JSON numbers use.as the decimal separator.Changes
CultureInfo.InvariantCultureThoth.JsonandThoth.Json.Corede-DEand verifies"0.7833"still decodes successfullyValidation
.\\build.bat test newtonsoft.\\build.bat test system-text-json