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

Array.prototype.toLocaleString uses comma space separator instead of just comma #6361

Closed
sunlili opened this issue Dec 22, 2019 · 7 comments
Closed

Comments

@sunlili
Copy link

sunlili commented Dec 22, 2019

I run following code in ch 1.11.15, the result of ChakraCore is different from other js engines. Though in specification, “string-concatenation” is not defined clearly, other engines’ output is same.

Code:

let arg_0 = ['Fire', '', 'Wind', 'Rain'];
arr2 = arg_0.toLocaleString();

print(JSON.stringify(arr2))

output of ch:
"Fire, , Wind, Rain"

output of other engines:
"Fire,,Wind,Rain"

ISec Lab
2019.12.21

@rhuanjl
Copy link
Collaborator

rhuanjl commented Mar 25, 2020

Per spec this is implementation defined, but:
a) all other engines just use a comma instead of comma & space AND
b) in toString (instead of toLocaleString) we use comma only

Should change be consistent - very easy fix change to use GetCommaDisplayString instead of GetCommaSpaceDisplayString here:
https://github.com/microsoft/ChakraCore/blob/c459fea95931c6736e4decd817f5c4d7ca40efc5/lib/Runtime/Library/JavascriptArray.cpp#L8393

Updating tests that use this may take a little while though - tagging as good first issue.

@rhuanjl rhuanjl changed the title Different Realization of "string-concatenation" from other engines Array.prototype.toLocaleString uses comma space separator instead of just comma Mar 25, 2020
@admud
Copy link
Contributor

admud commented Jul 28, 2020

Hi, could i work on this?

@ppenzin
Copy link
Member

ppenzin commented Aug 21, 2020

@muhdmud, sorry for the late reply - surely you can, let me know if you need any guidance on this.

@admud
Copy link
Contributor

admud commented Aug 24, 2020

@ppenzin yes thank you for the opportunity! I will have a go at it this week

@admud
Copy link
Contributor

admud commented Aug 30, 2020

@ppenzin Can I just submit a WIP pr with that oneliner change, then subsequently work on the tests? I assume the tests that i am suppose to be looking at is at chakracore/test/string concats, please correct me if im wrong

@ppenzin
Copy link
Member

ppenzin commented Sep 3, 2020

@muhdmud Sorry for late reply. Yes, that would be great!

@ppenzin
Copy link
Member

ppenzin commented Sep 25, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants