diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2023-09-03 01:13:50 +0300 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-09-11 08:20:52 +0100 |
commit | 00db3770b031c580feba47610169f077ac81dc4a (patch) | |
tree | a62a475ebdf1ec03b732ff7c1bc4e9ea7df8cff7 | |
parent | 76f5eb97229058841f83664cbff848a708626d3d (diff) | |
download | busybox-w32-00db3770b031c580feba47610169f077ac81dc4a.tar.gz busybox-w32-00db3770b031c580feba47610169f077ac81dc4a.tar.bz2 busybox-w32-00db3770b031c580feba47610169f077ac81dc4a.zip |
win32: UTF8_INPUT: fix combining of some surrogates pairs
The construction of a codepoint from a surrogates pair was incorrect
when the result should have had the 0x10000 bit unset, due to logical
"|" instead of arithmetic "+" of 0x10000 (so the 0x10000 bit was set
incorrectly when the result should have been U+[1]{0,2,4...C,E}XXXX).
For instance: typing or pasting U+20000 𠀀
-rw-r--r-- | win32/winansi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index 591154378..b5111603c 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -1276,7 +1276,7 @@ static void maybeEatUpto2ndHalfUp(HANDLE h, DWORD *ph1) | |||
1276 | 1276 | ||
1277 | // got 2nd-half-up. eat the events up to this, combine the values | 1277 | // got 2nd-half-up. eat the events up to this, combine the values |
1278 | ReadConsoleInputW(h, r, i, &got); | 1278 | ReadConsoleInputW(h, r, i, &got); |
1279 | *ph1 = 0x10000 | ((*ph1 & ~0xD800) << 10) | (h2 & ~0xDC00); | 1279 | *ph1 = 0x10000 + (((*ph1 & ~0xD800) << 10) | (h2 & ~0xDC00)); |
1280 | return; | 1280 | return; |
1281 | } | 1281 | } |
1282 | } | 1282 | } |