[whatwg/encoding] gb18030 encoder using index gb18030 ranges pointer (#258)

https://encoding.spec.whatwg.org/commit-snapshots/75b988c17cc2b90266e69526f399c7916c3e0ef0/#index-gb18030-ranges-pointer
https://encoding.spec.whatwg.org/commit-snapshots/75b988c17cc2b90266e69526f399c7916c3e0ef0/#gb18030-encoder

index-gb18030-ranges.txt maps more-or-less continuous pointers to Unicode values. Reverse process may produce invalid results due to the fact that Unicode values are not continuous: U+00A4, U+00A5 maps to 81 30 84 36; U+00A7, U+00A9 maps to 81 30 84 38; U+00A8, U+00AA maps to 81 30 84 39; Euro U+20AC, U+20AD maps to 81 36 B3 32, and so on.

A verification should be added to **gb18030 encoder**, like:
8a. Set _verification code point_ to the **index gb18030 ranges code point** for _pointer_.
8b. If _verification code point_ is not _code point_ then return **error** with _code point_.

or have I missed something?



-- 
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/258

Received on Monday, 3 May 2021 14:43:25 UTC