8000 fix: combine UTF-16 surrogate pairs before calling add_char by SAY-5 · Pull Request #446 · emoon/rust_minifb · GitHub
[go: up one dir, main page]

Skip to content

fix: combine UTF-16 surrogate pairs before calling add_char - #446

Merged
emoon merged 1 commit into
emoon:masterfrom
SAY-5:fix-utf16-surrogate-chars
Nov 24, 2026
Merged

emoon merged 1 commit into
emoon:masterfrom
SAY-5:fix-utf16-surrogate-chars

Conversation

@SAY-5
@SAY-5 SAY-5 commented Nov 23, 2026 •
Copy link
Copy Markdown
Contributor

WM_CHAR on Windows and characterAtIndex: on macOS both hand over UTF-16 code units, so an emoji or other non-BMP character reached add_char as two lone surrogates (for U+1F600 the callback got 0xD83D and then 0xDE00). Both backends now go through a shared KeyHandler::add_utf16_char that holds the high surrogate and passes the combined code point, the same way GLFW does it; X11 and Wayland already deliver whole code points and are unchanged. I don't have a Windows box, so the backends are only covered by cargo check --target x86_64-pc-windows-gnu plus a unit test on the shared helper that gets [97, 55357, 56832, 98] with the pairing taken out.

Fixes #423

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@emoon
emoon merged commit feb5455 into emoon:master Nov 24, 2026
5 checks passed
@emoon
emoon commented Nov 24, 2026
Copy link
Copy Markdown
Owner

Thanks!

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.

char callback receives unpaired UTF-16 surrogates for non-BMP input

2 participants

0