FIX: JSON support for non C locales

As reported in #4918.

Tested on Linux and Windows.