- From: Adam Rice <notifications@github.com>
- Date: Tue, 03 Sep 2019 21:24:40 -0700
- To: whatwg/encoding <encoding@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 4 September 2019 04:25:04 UTC
The `stream` option changes the handling of the end of the input to allow it to be in the middle of a character. Compare:
```javascript
decoder.decode(new Uint8Array([226, 153]), { stream: true });
// ""
decoder.decode(new Uint8Array([165]), { stream: true });
// "♥"
```
to
```javascript
decoder.decode(new Uint8Array([226, 153]));
// "��"
decoder.decode(new Uint8Array([165]));
// "�"
```
Even with `{stream: true}` the TextDecoder emits all complete characters as soon as possible.
You may find [TextDecoderStream](https://encoding.spec.whatwg.org/#interface-textdecoderstream) a more intuitive way to do the same thing.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/issues/184#issuecomment-527733881
Received on Wednesday, 4 September 2019 04:25:04 UTC