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

Open
sunlili opened this issue Dec 22, 2019 · 6 comments
Open

Comments

@sunlili
Copy link

@sunlili 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 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:

separator = scriptContext->GetLibrary()->GetCommaSpaceDisplayString();

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
@muhdmud
Copy link

@muhdmud muhdmud commented Jul 28, 2020

Hi, could i work on this?

@ppenzin
Copy link
Collaborator

@ppenzin ppenzin commented Aug 21, 2020

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

@muhdmud
Copy link

@muhdmud muhdmud commented Aug 24, 2020

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

@muhdmud
Copy link

@muhdmud muhdmud 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
Collaborator

@ppenzin ppenzin commented Sep 3, 2020

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

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.