Neither of encodings are correct
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 239
- Forks
- 27
- Avg merge
- 27m
- Merged PRs (30d)
- 1
Description
This is related to, but separate from #113 as it also affects non-browsers and is about correctness, not performance
From the Readme:
Node.js setEncoding doc: https://nodejs.org/api/stream.html#readablesetencodingencoding
Node.js Bufffer encodings doc: https://nodejs.org/api/buffer.html#buffers-and-character-encodings
But neither of encodings work:
hexis unsupported in browsersutf16le,base64andbase64urlare unsupported at alllatin1/asciibehavior on browsers differs from Node.jsutf-8is incorrect in general untiltext-encodingis bumped to^1.2.6
See https://github.com/holepunchto/text-decoder/issues/10, https://github.com/holepunchto/text-decoder/issues/11utf-8is still incorrect even on 1.2.6 when the input is truncated mid-character
e.g. if this line in tests is replaced withb4a.from('hællå wø').subarray(0, -1), the test fails (misses the last codepoint)
meta: I opened a single issue for all of those inconsistencies, that should be cleaner than filing that as separate ones.
This can be split into sub-issues.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the README encoding claims with the linked Node.js encoding documentation and inspect the encoding tests in test/readable.js. Check each listed encoding across browser and non-browser behavior, including truncated UTF-8 input. Done means the supported encodings match Node.js behavior and the cited test cases pass consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100