-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Document how to get swap endian for the Buffer class #12813
Comments
For what it’s worth, |
This would need to get called in every single place where buffers need to be turned into strings, which in a complex, pure Big Endian data file like an OpenType program is "tons of places", so not having a That's a ton of work that can be avoided by offering |
IIRC the only reason utf16le/ucs2 support exists is because that's (supposedly) how JS strings are stored internally in V8, so that encoding comes free. I'm not particularly keen on adding more encodings to core. There are third-party modules like |
To be clear, if there is a swap16, then offering the encoding That is, as long as the docs of course have a little note for that encoding to explain that using And in the mean time it might be worth updating the docs to, in the valid encodings section, mention that there is no |
I'm mainly concerned about the performance hit brought with having to check yet another encoding name, especially for an encoding that is not common (I would bet utf16le is just as uncommon). It's not so much the difficulty of the actual implementation of the encoding. |
Relabeling this issue as a documentation one then. |
I'm cool with doc improvements. |
Anybody up for volunteering for these doc improvements? |
Hi maintainer(s), analyzed the details of this "low-hanging", "good first issue" issue. Saw the timestamp as old as "Aug 10, 2017" in last comment, so I gave the simple PR a shot in #21111. Thanks in advance for review or issue comments here. I'll update the PR according, Or happy to close the PR if it's irrelevant. P.S: Was trying to look out for a test or any simple change with "good first issue", but there are a lot of enthusiastic contributors out there that the "triffic" is not exactly "light" 😅 Will keep looking out the labels on the issue list. P.P.S.: If anyone has advice for any "deeper" but still "good first issue" with a tiny bit of challenge, it's greatly appreciated. But I have been having a lot of fun updating docs as well. 👍 |
As the Buffer class currently only supports utf16 in little endian ordering, Buffer cannot be used to read in data from things like OpenType fonts, which by definition are always in big endian ordering, irrespective of the hardware or data reader (see https://www.microsoft.com/typography/OTSpec/otff.htm, "data types",
All OpenType fonts use Motorola-style byte ordering (Big Endian)
).Can Buffer be given a
utf16be
to match the already presentutf16le
, so that Buffer can be used with all utf16 data, rather than only with data that is in little endian ordering?The text was updated successfully, but these errors were encountered: