-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yajl_gen_double uses a comma instead of a point #222
Comments
Looks like a localization issue. French using the comma where json would expect a dot. |
Indeed, with further testing I figured everything works like a charm using |
Two options for fixing this on yajl side come to mind. The first is to call setlocale(LC_NUMERIC, "C") before the sprintf and use the returned value from setlocale to reset after the sprintf. This can also be done in the calling code of yajl. The second option is for yajl to call localeconv and use the value of the returned struct lconv field decimal_point to determine if the locale should be changed, or if the decimal point in the output of the sprintf should have the decimal point be changed. Since C locale is global to a program, it might be even better to avoid locale at all and check for comma in the output of sprintf in yajl_gen_double and replace it with a dot. This will have a negative performance impact. |
Any updates on this? |
All is in the title.
Here is sample code:
Here is the output:
So as you can see, this produces invalid JSON since the comma cannot be used here as a delimiter.
Is it normal, how can I solve this?
Thanks
Edit: my version: 2.1.0-2, my OS language setting is French if this can help, if it has to do with formatting from the os or anything
The text was updated successfully, but these errors were encountered: