Bug 156459 - Windows: WM_UNICHAR message handled incorrectly
Summary: Windows: WM_UNICHAR message handled incorrectly
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Windows (All)
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-25 06:38 UTC by Mike Kaganski
Modified: 2023-07-27 20:55 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-07-25 06:38:12 UTC
Using SentMessage utility [1], and WM_UNICHAR message documentation [2]:

1. Create a new text document in Writer;
2. launch SendMessage utility, and drag its "target" tool to the Writer's main area to find its window;
3. Put '0x0109' (i.e., WM_UNICHAR hex value) to 'Message' box in SendMessage;
4. Put '0x1F34E' (i.e., U+1F34E "RED APPLE") to 'WPARAM' box in SendMessage;
5. Put 0 to LPARAM box in SendMessage;
6. Press [ SendMessage ] button.

Expected result: an apple character in Writer; following Alt+X there should result in U+1f34e (this should be true, even if no font on system provides the apple character).

Actual result: a "whitespace" character is shown in Writer; Alt+X there results in U+df4e (the low surrogate of the correct 'D83C DF4E' UTF-16 surrogate pair).

Wrong implementation of the message support from start, not passing the high surrogate to the frame.

[1] https://tools.stefankueng.com/SendMessage.html
[2] https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-unichar
Comment 1 Mike Kaganski 2023-07-27 17:12:25 UTC
https://gerrit.libreoffice.org/c/core/+/154996
Comment 2 Commit Notification 2023-07-27 20:54:54 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/724ba1e455d4ae47a00248586487443347f1be96

tdf#156459: fix WM_UNICHAR implementation

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.