Skip to content

Encoding: accept the full Shift_JIS upper lead byte range - #424

Merged
lexborisov merged 2 commits into
lexbor:masterfrom
cliff-openai:cliff/lexbor-shift-jis-decoding
Sep 26, 2026
Merged

lexborisov merged 2 commits into
lexbor:masterfrom
cliff-openai:cliff/lexbor-shift-jis-decoding

Conversation

@cliff-openai

Copy link
Copy Markdown
Contributor

Shift_JIS permits two lead byte ranges: 0x81-0x9F and 0xE0-0xFC. Before this change, the decoder handles the lower range correctly but accepts only 0xE0 and 0xFC in the upper range, rejecting valid inbetween. Valid pairs such as E3 59 (U+7DBA) therefore decode as an error followed by the ASCII trail byte instead of one character.

Fix this by using the inclusive 0xE0-0xFC range in both the buffered and single codepoint decoders, as required by https://encoding.spec.whatwg.org/#shift_jis-decoder.

cliff-openai and others added 2 commits September 25, 2026 10:56
Shift_JIS permits two lead byte ranges: 0x81-0x9F and 0xE0-0xFC. Before this change, the decoder handles the lower range correctly but accepts only 0xE0 and 0xFC in the upper range, rejecting valid inbetween. Valid pairs such as E3 59 (U+7DBA) therefore decode as an error followed by the ASCII trail byte instead of one character.

Fix this by using the inclusive 0xE0-0xFC range in both the buffered and single codepoint decoders, as required by https://encoding.spec.whatwg.org/#shift_jis-decoder.
@lexborisov
lexborisov merged commit 7314185 into lexbor:master Sep 26, 2026
1 check passed
@lexborisov

Copy link
Copy Markdown
Member

Hi @cliff-openai

Thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants