Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug of number parse and stringify when locale settings is special #106

Closed
twinstar6980 opened this issue Jan 12, 2022 · 2 comments
Closed

Comments

@twinstar6980
Copy link

VERSION: quickjs 2021-03-27
OS: Win11-21H2-ZHCN and Win10-21H2-RUSSIAN

I use quickjs to run javascript in my program, but my user report a problem.
When I change the number point as comma, quickjs can't parse and stringify float correctly, but in some countries(like russia),the default number point of windows PC is comma.
for example:
22-01_13-02-48-05_Snipper - Snipaste
I found the reason on "quickjs.c"
"strtod" will called on "js_strtod", "snprintf" will called on "js_fcvt1", when parse or stringify a Number object, js_strtod and js_fcvt1 will be called. , strtod and snprintf will use comma be a number point when system number point is comma
22-01_13-04-02-12_core - Microsoft Visual Studio
22-01_13-04-05-24_core - Microsoft Visual Studio

I hope this bug can be fixed

@twinstar6980 twinstar6980 changed the title A bug of number parse and stringify whenlocale settings is special A bug of number parse and stringify when locale settings is special Jan 12, 2022
@bellard
Copy link
Owner

bellard commented May 5, 2022

locale settings are not supported by QuickJS so it behaves as expected.

@bellard bellard closed this as completed May 5, 2022
@fstirlitz
Copy link
Contributor

This is not mentioned in the documentation, and even if it were, this is a very silly design decision to make. Locales are a perfectly legitimate feature of the C standard, relied on by many desktop applications, some of which may even not be directly written in C. This issue would be very easy to trigger when QuickJS is embedded as a scripting engine in another program.

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

No branches or pull requests

3 participants