Closed haraldh closed 3 years ago
fix: correct the float number parsing for some locales
Some locales use a different radix character for numbers.
Modify the LC_NUMERIC locale for the two functions globally to correctly parse and write float numbers with a ".".
This didn't work previously, because uselocale() was not called.
uselocale()
Also use duplocale() to preserve a previously set locale and restore that with uselocale().
duplocale()
tests: add test with de_DE.UTF-8 locale
de_DE.UTF-8 uses , as the radix character. Check if json parsing and writing switches to the C LC_NUMERIC.
,
fix: correct the float number parsing for some locales
Some locales use a different radix character for numbers.
Modify the LC_NUMERIC locale for the two functions globally to correctly parse and write float numbers with a ".".
This didn't work previously, because
uselocale()
was not called.Also use
duplocale()
to preserve a previously set locale and restore that withuselocale()
.tests: add test with de_DE.UTF-8 locale
de_DE.UTF-8 uses
,
as the radix character. Check if json parsing and writing switches to the C LC_NUMERIC.