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

Buffer.prototype.toLocaleString needs a Buffer-specific implementation #8147

Closed
jasnell opened this issue Aug 17, 2016 · 0 comments
Closed
Labels
buffer Issues and PRs related to the buffer subsystem. i18n-api Issues and PRs related to the i18n implementation.

Comments

@jasnell
Copy link
Member

jasnell commented Aug 17, 2016

The toLocaleString() method is intended to provide a locale-sensitive toString() variant for various types.

> Buffer.prototype.toLocaleString === Uint8Array.prototype.toLocaleString
true
> Buffer.from('test').toString()
'test'
> Buffer.from('test').toLocaleString()
'116,101,115,116'
>

Buffer's toLocaleString() is inherited from Uint8Array which makes it less than useful. For the time being, it should likely simply defer to toString() using the default platform charset.

/cc @trevnorris @srl295 @addaleax

(PR incoming soon)

@jasnell jasnell added buffer Issues and PRs related to the buffer subsystem. i18n-api Issues and PRs related to the i18n implementation. labels Aug 17, 2016
jasnell added a commit to jasnell/node that referenced this issue Aug 17, 2016
Make Buffer.prototype.toLocaleString an alias of Buffer.prototype.toString
so that the output is actually useful.

Fixes: nodejs#8147
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. i18n-api Issues and PRs related to the i18n implementation.
Projects
None yet
Development

No branches or pull requests

1 participant