Migrate window class registration and window creation to Unicode APIs#1468
Merged
sylvessa merged 1 commit intosmartcmd:mainfrom Apr 6, 2026
Merged
Migrate window class registration and window creation to Unicode APIs#1468sylvessa merged 1 commit intosmartcmd:mainfrom
sylvessa merged 1 commit intosmartcmd:mainfrom
Conversation
sylvessa
reviewed
Apr 5, 2026
| wcex.lpszClassName = "MinecraftClass"; | ||
| wcex.lpszMenuName = L"Minecraft"; | ||
| wcex.lpszClassName = L"MinecraftClass"; | ||
| wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_MINECRAFTWINDOWS)); |
Collaborator
There was a problem hiding this comment.
wouldnt we want to make this LoadIconW too?
Contributor
Author
There was a problem hiding this comment.
wouldnt we want to make this LoadIconW too?
There will be no difference between ANSI and Unicode API in this case.
Collaborator
There was a problem hiding this comment.
fair. just asked cause consistency
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.
Description
Migrate window class registration and window creation from ANSI (RegisterClassA / CreateWindowA) to Unicode (RegisterClassW / CreateWindowW) APIs. This ensures proper handling of non-ASCII characters in text input.
Previous Behavior
Window class and windows were created using ANSI APIs.
WM_CHAR messages delivered characters encoded in the system code page, leading to incorrect display of non-ASCII text (e.g., Cyrillic, accented characters).
Root Cause
The use of ANSI APIs meant that character data was limited to the system code page. Non-ASCII input could not be represented correctly, resulting in garbage characters in text fields.
New Behavior
Window class registration and window creation now use Unicode APIs.
WM_CHAR messages now provide correct UTF-16 codepoints.
Non-ASCII characters are properly entered and displayed in text fields.
Fix Implementation
Replaced RegisterClassA with RegisterClassW and updated WNDCLASS/WNDCLASSEX structures to use wide-character strings.
Replaced CreateWindowA with CreateWindowW and ensured all string parameters are UTF-16 (L"...") literals.
Note: This will NOT solve the problem of entering Chinese and other characters; they simply aren't in the font. For that, we need to implement a fallback to GNU Unifont.
Note2: This is a remake of the request #950
Screenshot