kgabis / parson

Lightweight JSON library written in C.
MIT License
1.35k stars 329 forks source link

Number parsing broken for some locales #142

Closed yanchoyanev closed 4 years ago

yanchoyanev commented 4 years ago

Some locales use a comma as a decimal point. Others use the comma to separate thousands. In these cases the number parsing is broken if the value is not in double quotes, like this:

{ Num: 9, Str: "something" }

The strtod call should use the C locale, not the default one.

kgabis commented 4 years ago

Per https://github.com/kgabis/parson/issues/98#issuecomment-589346669. There's no good way of fixing this. Use setlocale.