Re: [whatwg/encoding] Prepending or conversion of a sequence possibly not exact enough explained (#239)

May I suggest how to get rid of one prepend in section 6 in **UTF-8 decode**? Do not use **read** but **peek** instead.

1. Let buffer be the result of peeking three bytes from ioQueue.
(My note: buffer contains 0 to 3 bytes afterwards, the ioQueue is left untouched)
2. If buffer matches 0xEF 0xBB 0xBF (U+FFFE BOM), read 3 Bytes from ioQueue and discard the result.
(My note: this removes a leading BOM sequence, if present. One should look up the comparison procedure for correct wording, I do not care for now)
3. Run UTF-8’s decoder with ioQueue and output. 
4. Return output.

-- 
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/239#issuecomment-716049256

Received on Saturday, 24 October 2020 20:14:22 UTC