(Sorry, I accidentally closed the original issue)
The functions strtod() (used in yajl_parser) and sprintf() (yajl_gen) are locale-dependent and thus cannot be reliably used to convert JSON values. The only reasonable solution I found to this was using setlocale() to insert the "C" locale. However, this can introduce side-effects, so I locally set and then restore it, like this:
char oldLocale; / Example for converting doubles /
oldLocale = setlocale(LC_ALL, NULL); / saving old locale /
setlocale(LC_ALL, "C"); / ensuring POSIX locale /
sprintf(i, "%g", number); / now the conversion works as expected /
setlocale(LC_ALL, oldLocale); / restoring locale */
This is, however, probably an inefficient quick fix. The locale should be set before starting the parsing/generation phases and restored at the end, if this does not affect string conversion.
what can I set the locale to to induce failure?