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

Comments

Projects
None yet
3 participants
@eddyw
Copy link

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

This comment has been minimized.

Copy link
Member

commented Sep 20, 2017

Am I missing something?

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

@vsemozhetbyt

This comment has been minimized.

Copy link
Member

commented Sep 20, 2017

@eddyw

This comment has been minimized.

Copy link
Author

commented Sep 20, 2017

@bnoordhuis cool, thanks!
Issue is solved

@eddyw eddyw closed this Sep 20, 2017

@eddyw

This comment has been minimized.

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.