-
Notifications
You must be signed in to change notification settings - Fork 77
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
What's the correct use of {stream: true} option for Textdecoder.decode #184
Comments
The decoder.decode(new Uint8Array([226, 153]), { stream: true });
// ""
decoder.decode(new Uint8Array([165]), { stream: true });
// "♥" to decoder.decode(new Uint8Array([226, 153]));
// "��"
decoder.decode(new Uint8Array([165]));
// "�" Even with You may find TextDecoderStream a more intuitive way to do the same thing. |
@ricea So it's for multi-byte decoding, that make sense and TextDecoderStream is what I'm looking for, hopefully it'll be available soon |
…le of non-English character (#28) Ensure that the decoder.decode function can properly handle instances where the input stream ends mid-way through a multi-byte, non-English character. For more details, refer to the discussion at [Issue #184 on the encoding GitHub page](whatwg/encoding#184 (comment)).
Just came cross there is a second option can be passed to decoder, My first thought about it is a buffer, so I can do
and append another buffer
and finally get me a string back which include the 2 parts
but it isn't the case
the first two expression return "abc" and "def" the third give me empty, just like them without the stream option. and I've tried TextDecoder in Nodejs, it have the same behaviour
Can anyone can tell me how to use it correctly?
The text was updated successfully, but these errors were encountered: