Skip to content

Fix locale-dependent JSON float parsing in fvec_from_value#303

Open
stumpylog wants to merge 1 commit into
asg017:mainfrom
stumpylog:main
Open

Fix locale-dependent JSON float parsing in fvec_from_value#303
stumpylog wants to merge 1 commit into
asg017:mainfrom
stumpylog:main

Conversation

@stumpylog

Copy link
Copy Markdown

Replace strtod() with a custom strtod_c() that always uses '.' as the decimal separator. strtod(3) respects LC_NUMERIC, so locales like fr_FR or de_DE caused JSON vector literals (e.g. '[0.1, 0.2, 0.3]') to be rejected with "JSON parsing error".

fixes #241

…017#241)

Replace strtod() with a custom strtod_c() that always uses '.' as the
decimal separator. strtod(3) respects LC_NUMERIC, so locales like fr_FR
or de_DE caused JSON vector literals (e.g. '[0.1, 0.2, 0.3]') to be
rejected with "JSON parsing error".
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.

strtod is locale-dependent (LC_NUMERIC) and breaks JSON float parsing under non-C locales (e.g. French)

1 participant