Skip to content

Similarities to TextEncoder #1027

Answered by bnoordhuis
harumazzz asked this question in Q&A
Discussion options

You must be logged in to vote

We did add some non-ECMA-but-web-spec things in #16. I wouldn't object to TextEncoder, although:

  1. TextEncoderStream is off the table because that means pulling in all of web streams, and

  2. Supporting more than, let's say, UTF-8 and ISO-8559-1 in TextDecoder is unlikely because too much complexity, making it kind of anemic

I think using charCodeAt and setUint8 will not guarantee for utf8 character

Indeed it won't; utf-8 is a variable-length encoding. Doing that encoding manually is not super hard but, as Saúl mentions, polyfills exist.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bnoordhuis
Comment options

Answer selected by harumazzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants