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

Problem with Intl API and toLocaleString in NodeJS #832

Closed
eddyw opened this issue Sep 20, 2017 · 4 comments
Closed

Problem with Intl API and toLocaleString in NodeJS #832

eddyw opened this issue Sep 20, 2017 · 4 comments

Comments

@eddyw
Copy link

@eddyw eddyw commented Sep 20, 2017

  • Node.js Version: v8.4.0
  • OS: MacOS
  • Scope (install, code, runtime, meta, other?): code
  • Module (and version) (if relevant): --

Running the following in Google Chrome, for example:

(1314).toLocaleString('ar-EG') // Outputs:  "١٬٣١٤"
(1314).toLocaleString('zh-Hant-u-nu-hanidec') // Outputs:  "一,三一四"
(131400).toLocaleString('hi-IN') // Outputs: "1,31,400"

However, in NodeJS, running the same code:

(1314).toLocaleString('ar-EG') // Outputs:  "1,314"
(1314).toLocaleString('zh-Hant-u-nu-hanidec') // Outputs:  "1,314"
(131400).toLocaleString('hi-IN') // Outputs: "131,400"

Why? Am I missing something?
Intl API (new Intl.NumberFormat('[encoding]').format(1314)) behaves the same way.

@bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented Sep 20, 2017

Am I missing something?

Yes, https://www.npmjs.com/package/full-icu :-)

@eddyw
Copy link
Author

@eddyw eddyw commented Sep 20, 2017

@bnoordhuis cool, thanks!
Issue is solved

@eddyw eddyw closed this Sep 20, 2017
@eddyw
Copy link
Author

@eddyw eddyw commented Sep 21, 2017

@vsemozhetbyt thanks, I did wrong assuming NodeJS already includes all the Unicode data set. I haven't worked with Intl API on server-side before

chitoku-k added a commit to chitoku-k/chitoku.jp that referenced this issue Feb 19, 2019
See also: nodejs/help#832
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants