Skip to content

LC_NUMERIC locale #5

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

Merged
merged 1 commit into from
Jul 9, 2014
Merged

Conversation

cdunn2001
Copy link
Contributor

non-English locales often use ',' instead of '.' for numbers,
contrary to the JSON standard.

See:

@cdunn2001 cdunn2001 closed this Jul 9, 2014
@cdunn2001 cdunn2001 deleted the locale branch July 9, 2014 05:14
@cdunn2001 cdunn2001 restored the locale branch July 9, 2014 05:15
@cdunn2001 cdunn2001 reopened this Jul 9, 2014
@steffen-kiess
Copy link

The problem I see with this approach is that the library changes global state, which might cause problems with multithreaded programs.

…sion

`snprintf()` will use the current `LC_NUMERIC` locale
for converting a double to a string,
which will use a `,` instead of a `.` in some locales (e.g. de_DE).
`std::stringstream` allows setting the locale to `"C"` to always get a `.`.
This occurs only for that `stringstream` instance; no global is
altered.
@cdunn2001 cdunn2001 closed this Jul 9, 2014
@cdunn2001 cdunn2001 deleted the locale branch July 9, 2014 18:34
@cdunn2001
Copy link
Contributor Author

Oops. True. And I misunderstood your solution. I thought you were altering the global too. Your way is not so bad, and the library is not intended for highest efficiency anyway.

Ok. I'll put it back.

This ticket might interest you.

@cdunn2001 cdunn2001 reopened this Jul 9, 2014
@cdunn2001 cdunn2001 merged commit eab3096 into open-source-parsers:master Jul 9, 2014
@cdunn2001
Copy link
Contributor Author

Rebased, but done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants