diff --git a/src/json.hpp b/src/json.hpp index 51b195185..f1666c6c6 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -9108,7 +9108,7 @@ basic_json_parser_66: // this is a helper to determine whether to // parse the token into floating-point or // integral type. We wouldn't need it if - // we had separate token types for interal + // we had separate token types for integral // and floating-point cases. bool is_integral() const { @@ -9172,9 +9172,19 @@ basic_json_parser_66: const char* data = m_start; const size_t len = static_cast(m_end - m_start); +#if 0 const char decimal_point_char = std::use_facet< std::numpunct >( std::locale()).decimal_point(); +#else + // Since dealing with strtod family of functions, + // need to use the C locales instead of C++ + const auto loc = localeconv(); + assert(loc != nullptr); + const char decimal_point_char = + !loc->decimal_point ? '.' + : loc->decimal_point[0]; +#endif // replace decimal separator with locale-specific // version, when necessary; data will be repointed diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index e5f344b22..b80590354 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -8257,7 +8257,7 @@ class basic_json // this is a helper to determine whether to // parse the token into floating-point or // integral type. We wouldn't need it if - // we had separate token types for interal + // we had separate token types for integral // and floating-point cases. bool is_integral() const { @@ -8321,9 +8321,19 @@ class basic_json const char* data = m_start; const size_t len = static_cast(m_end - m_start); +#if 0 const char decimal_point_char = std::use_facet< std::numpunct >( std::locale()).decimal_point(); +#else + // Since dealing with strtod family of functions, + // need to use the C locales instead of C++ + const auto loc = localeconv(); + assert(loc != nullptr); + const char decimal_point_char = + !loc->decimal_point ? '.' + : loc->decimal_point[0]; +#endif // replace decimal separator with locale-specific // version, when necessary; data will be repointed