https://bugs.winehq.org/show_bug.cgi?id=54424
Bug ID: 54424 Summary: user32:edit - test_dbcs_WM_CHAR() fails on Windows in mixed locales Product: Wine Version: unspecified Hardware: x86-64 OS: Windows Status: NEW Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com
user32:edit - test_dbcs_WM_CHAR() fails on Windows in mixed locales:
edit.c:3407: Test failed: W: got L"\02c6\00ea\201c", expected L"\4e00\4e8c\4e09" edit.c:3412: Test failed: W: got "?e\x81gn?O", expected "\x88\xea\x93\xf1\x8eO"
See https://test.winehq.org/data/patterns.html#user32:edit
The failures happen in the w10pro64-mx-MX test configuration. What's special about it is that it uses a mix of locales:
SystemDefaultLCID 0411 UserDefaultLCID 040c ThreadLocale 0411 SystemPreferredUILanguages 0412,0409 UserDefaultUILanguage 0412 ThreadUILanguage 0412 Country 231 ACP 932
The failures started happening with the commit that introduced the new tests:
commit cbe3a39b647e029df16faf1dcce2958f1ee418d0 Author: Akihiro Sagawa sagawa.aki@gmail.com AuthorDate: Fri Jan 20 23:51:36 2023 +0900
user32/tests: Add DBCS WM_CHAR tests for edit control.
https://bugs.winehq.org/show_bug.cgi?id=54424
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression, source, | |testcase Regression SHA1| |cbe3a39b647e029df16faf1dcce | |2958f1ee418d0 CC| |sagawa.aki+winebugs@gmail.c | |om
https://bugs.winehq.org/show_bug.cgi?id=54424
--- Comment #1 from François Gouget fgouget@codeweavers.com --- So the failure results from interpreting a string in the 932 code page using the 1252 codepage:
L"\4e00\4e8c\4e09" -- CP_ACP --> "\x88\xea\x93\xf1\x8eO" L"\4e00\4e8c\4e09" -- 932 --> "\x88\xea\x93\xf1\x8eO"
"\x88\xea\x93\xf1\x8eO" -- CP_ACP --> L"\4e00\4e8c\4e09" "\x88\xea\x93\xf1\x8eO" -- 932 --> L"\4e00\4e8c\4e09" "\x88\xea\x93\xf1\x8eO" -- 1252 --> L"\02c6\00ea\201c"
Where that last line corresponds to the unexpected result.
More specifically, the issue is that CP_ACP is 932 (from ThreadUILanguage) but WM_CHAR interprets the characters using the user locale's default code page, 1252 in the TestBot's mixed locales configuration:
https://bugs.winehq.org/show_bug.cgi?id=54424
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|wine-bugs@winehq.org |fgouget@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=54424
--- Comment #2 from François Gouget fgouget@codeweavers.com --- The code page WM_CHAR uses is actually more likely to be based on the keyboard layout, as per Wine's get_input_codepage(). It's just that in the TestBot configurations the keyboard layout always matches the user locale.
Sent a merge request: https://gitlab.winehq.org/wine/wine/-/merge_requests/2661
https://bugs.winehq.org/show_bug.cgi?id=54424
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |8b8d787d7dc0b2ff2894968173b | |fcf763f16e131 Status|NEW |RESOLVED
--- Comment #3 from François Gouget fgouget@codeweavers.com --- This is fixed:
commit 8b8d787d7dc0b2ff2894968173bfcf763f16e131 Author: François Gouget fgouget@codeweavers.com Date: Mon Apr 17 14:44:06 2023 +0200
user32/tests: Fix the DBCS WM_CHAR tests in mixed locales.
WM_CHAR interprets the character codes using a code page tied to the keyboard layout, not CP_ACP. Also skip the test if WideCharToMultiByte() used the default character since that breaks the round-trip. Trace the code page when skipping the tests.
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=54424
https://bugs.winehq.org/show_bug.cgi?id=54424
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.7.
https://bugs.winehq.org/show_bug.cgi?id=54424
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |8.0.x