Description of changes: To summarize the core issue, some cultures parse negative integers differently. For example, "en-US" will return -1 (dash) when (-1).ToString(); is called. But "sv-SE" will return −1 (minus sign). This can be observed in BigDecimal.cs on line 455: sb.Append(-d);. This reults in invalid JSON being generated when using an IonTextWriterBuilder to down-convert ION to JSON. The problematic line was changed to sb.Append((-d).ToString(CultureInfo.InvariantCulture));. Tests were added to TextWriterJsonTest.cs and BigDecimalTest.cs to ensure the correct behavior.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available: #137
Description of changes: To summarize the core issue, some cultures parse negative integers differently. For example, "en-US" will return
-1
(dash) when(-1).ToString();
is called. But "sv-SE" will return−1
(minus sign). This can be observed inBigDecimal.cs
on line 455:sb.Append(-d);
. This reults in invalid JSON being generated when using anIonTextWriterBuilder
to down-convert ION to JSON. The problematic line was changed tosb.Append((-d).ToString(CultureInfo.InvariantCulture));
. Tests were added toTextWriterJsonTest.cs
andBigDecimalTest.cs
to ensure the correct behavior.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.