You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A locale may output "3,1416" instead of "3.1416" due to locale setting. JSON should always uses . as decimal separator. Need to also check other similar issues such as digit grouping, e.g. "123,456.789" is invalid JSON number.
The text was updated successfully, but these errors were encountered:
Currently Writer::Double() simply uses snprintf() to convert a double to string. snprintf() uses the locale settings set by setlocale().
An idea is to setlocale(LC_NUMERIC, "C") before snprintf() and restore the locale after. However, there is no getlocale() in standard C library for backup.
Another way is to develop a custom dtoa() which neglects locale altogether. This way the code can be potentially optimized .
You can use setlocale for querying the locale as well:
If locale is a null pointer, setlocale queries the current C locale without modifying it.
On the other hand, it may be quite costly to fiddle with the locale in each call to Writer::Double. As a first step, it could be added to the documentation that the user should take care for this in the application code.
Upstream https://code.google.com/p/rapidjson/issues/detail?id=84
A locale may output "3,1416" instead of "3.1416" due to locale setting. JSON should always uses
.
as decimal separator. Need to also check other similar issues such as digit grouping, e.g. "123,456.789" is invalid JSON number.The text was updated successfully, but these errors were encountered: