[whatwg/encoding] Ambiguous wording in GB18030 decoder (Issue #325)

### What is the issue with the Encoding Standard?

I am struggling to understand what "Prepend *gb18030 second* followed by *byte* to ioQueue" exactly means in [gb18030 decoder](https://encoding.spec.whatwg.org/#gb18030-decoder) step 4.2.

Does it mean to prepend a sequence containing *gb18030 second* and *byte* or does it mean first prepend *gb18030 second*, then prepend *byte*? This is the only place where this wording is used in the context of "prepend". All the other usages of "prepend" are unambiguous.

As a side note, I propose to entirely get rid of the concept of prepending a sequence. It is used only in one place, in step 5.5 of [utf-16-decoder](https://encoding.spec.whatwg.org/#shared-utf-16-decoder), and it only clutters understanding. It would be much clearer to just say "if *UTF-16BE decoder* is true prepend *byte2*, then prepend *byte1*, otherwise, prepend *byte1*, then prepend *byte2*". The note just above [4. Encodings](https://encoding.spec.whatwg.org/#encodings) says that "prepend operation is an internal detail of the algorithms in this specification, and is not to be used by other standards", so it looks safe to remove this concept.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/issues/325
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/encoding/issues/325@github.com>

Received on Saturday, 2 March 2024 15:21:27 UTC