Repository navigation
fix(convert): decode JIS X 0212 0x2237 to a single character - #69
Merged
polygonplanet merged 1 commit intoOct 2, 2026
Merged
Conversation
EUCJPToUTF8() and JISToUTF8() always wrote at least two bytes for a JIS X 0212 table value, so 0x2237, which maps to ~, decoded to a NUL followed by ~.
Owner
|
@youdie006 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EUCJPToUTF8()andJISToUTF8()always write at least two bytes for a JIS X 0212 table value. 0x2237 is the one entry that maps to ASCII (~), so EUC-JP8F A2 B7decodes to a NUL followed by~:The ISO-2022-JP form (
ESC $ ( D+22 37) does the same. glibciconv -t EUC-JPwrites~(as in10時~12時) as these bytes, so the NUL shows up in real text. Python'seuc_jpdecodes them to~, and glibc iconv and WHATWGTextDecoderto~; all return one character.This writes values below 0x80 as one byte. Converting every EUC-JP, JIS and SJIS code to each target, only the six outputs for 0x2237 to UTF8, UNICODE and UTF16 change. Added a test;
npm testandnpm run lintpass.Written with AI assistance (Claude); I have reviewed the change.