Skip to content

commondialogs: match full width '|'#838

Open
zx2c4 wants to merge 1 commit into
lxn:masterfrom
zx2c4-forks:jd/full-width-match
Open

commondialogs: match full width '|'#838
zx2c4 wants to merge 1 commit into
lxn:masterfrom
zx2c4-forks:jd/full-width-match

Conversation

@zx2c4
Copy link
Copy Markdown
Contributor

@zx2c4 zx2c4 commented Apr 20, 2026

A bug was encountered in the localization from:
Configuration Files (.zip, .conf)|.zip;.conf|All Files (.)|.
to:
구성 파일 (.zip, .conf)|.zip;.conf|All Files (.)|.

Converting the latter into utf16 yields this sequence:

00000000  6c ad 31 c1 20 00 0c d3  7c c7 20 00 28 00 2a 00  |l.1. ...|. .(.*.|
00000010  2e 00 7a 00 69 00 70 00  2c 00 20 00 2a 00 2e 00  |..z.i.p.,. .*...|
00000020  63 00 6f 00 6e 00 66 00  29 00 7c 00 2a 00 2e 00  |c.o.n.f.).|.*...|
00000030  7a 00 69 00 70 00 3b 00  2a 00 2e 00 63 00 6f 00  |z.i.p.;.*...c.o.|
00000040  6e 00 66 00 7c 00 41 00  6c 00 6c 00 20 00 46 00  |n.f.|.A.l.l. .F.|
00000050  69 00 6c 00 65 00 73 00  20 00 28 00 2a 00 2e 00  |i.l.e.s. .(.*...|
00000060  2a 00 29 00 7c 00 2a 00  2e 00 2a 00              |*.).|.*...*.|

Notice on the top line, 0x7c, which is '|'. The old code thus replaced 7c c7 with 00 00, because it cast each utf16 character to a single byte before doing the comparison.

Fix this by instead comparing the full utf16 character against the the utf16 representation of '|', 7c 00.

A bug was encountered in the localization from:
    Configuration Files (*.zip, *.conf)|*.zip;*.conf|All Files (*.*)|*.*
to:
    구성 파일 (*.zip, *.conf)|*.zip;*.conf|All Files (*.*)|*.*

Converting the latter into utf16 yields this sequence:

00000000  6c ad 31 c1 20 00 0c d3  7c c7 20 00 28 00 2a 00  |l.1. ...|. .(.*.|
00000010  2e 00 7a 00 69 00 70 00  2c 00 20 00 2a 00 2e 00  |..z.i.p.,. .*...|
00000020  63 00 6f 00 6e 00 66 00  29 00 7c 00 2a 00 2e 00  |c.o.n.f.).|.*...|
00000030  7a 00 69 00 70 00 3b 00  2a 00 2e 00 63 00 6f 00  |z.i.p.;.*...c.o.|
00000040  6e 00 66 00 7c 00 41 00  6c 00 6c 00 20 00 46 00  |n.f.|.A.l.l. .F.|
00000050  69 00 6c 00 65 00 73 00  20 00 28 00 2a 00 2e 00  |i.l.e.s. .(.*...|
00000060  2a 00 29 00 7c 00 2a 00  2e 00 2a 00              |*.).|.*...*.|

Notice on the top line, 0x7c, which is '|'. The old code thus replaced
7c c7 with 00 00, because it cast each utf16 character to a single byte
before doing the comparison.

Fix this by instead comparing the full utf16 character against the the
utf16 representation of '|', 7c 00.

Reported-by: 오한웅 <oho790114@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
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.

1 participant