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

Request UTF-32 Character Encoding #5956

Closed
PsyTae opened this issue Mar 30, 2016 · 7 comments
Closed

Request UTF-32 Character Encoding #5956

PsyTae opened this issue Mar 30, 2016 · 7 comments
Labels
buffer Issues and PRs related to the buffer subsystem. feature request Issues that request new features to be added to Node.js.

Comments

@PsyTae
Copy link

PsyTae commented Mar 30, 2016

  • Version: v5.4.0
  • Platform: Windows 7 Professional 64 bit
  • Subsystem: buffer

Character encoding for buffer.

Why are utf-8 and utf-16 included for Buffer Encoding but UTF-32 is not? UTF-32 is just as prevalent and even more useful than the first two including more options for characters.

@Fishrock123
Copy link
Contributor

@PsyTae IIRC it's because of what JavaScript/v8 supports.

cc @trevnorris

@Fishrock123 Fishrock123 added buffer Issues and PRs related to the buffer subsystem. feature request Issues that request new features to be added to Node.js. labels Mar 30, 2016
@mscdex
Copy link
Contributor

mscdex commented Mar 30, 2016

I wouldn't say that UTF-32 is more useful than UTF-8, but no matter what you can always use the iconv or iconv-lite modules to do necessary conversions.

@jasnell
Copy link
Member

jasnell commented Mar 30, 2016

This one may actually make sense to get added, although it's likely fairly non-trivial. I'm willing to take this on to investigate.

@trevnorris
Copy link
Contributor

One-byte (i.e. 'binary', which is actually latin1), Two-Byte ('utf16-le') and Utf8 ('utf8') are all built in support. 'ascii' exists for legacy reasons, back when it was natively supported by v8. 'hex' and 'base64', I believe, both exist as requirements for other modules.

There have been requests in the past (see #2835) to support extending supported Buffer encodings, but doing this is tricky. For example, the call to setEncoding() won't work. Which means the user would still need to run chunk.toString(<encoding>) anyway. Also easily enough accomplished by just passing the chunk to a module function.

So I'd say iconv-lite is an excellent module to use for more than just the basic encodings provided by core.

@PsyTae
Copy link
Author

PsyTae commented Mar 31, 2016

That chunk.toString(<encoding>) is actually one of the features I am looking forward to the most for the utf-32 character set. that and taking a string and breaking it back out to a utf-32 buffer.

I also don't want to be dependent on Python to build the native code for iconv.

@mscdex
Copy link
Contributor

mscdex commented Mar 31, 2016

@PsyTae You might submit an issue at iconv-lite requesting UTF-32 support and just use that module.

@jasnell
Copy link
Member

jasnell commented Apr 19, 2016

Given the responses, going to close this as it's not likely to happen in core.

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. feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

No branches or pull requests

5 participants