ListView in-place edit box not showing correct Unicode character when typed

David H 0 Reputation points
2025-04-07T23:49:51.5033333+00:00

Issue Description

When using an ANSI application that uses the UTF-8 code page, typing a non-ASCII character into a ListView's in-place edit box will result in nonsense characters being entered.

I have observed this by using a UK keyboard and attempting to enter the pound sign by typing Shift+3, or by using the Alt code Alt+0163. This can also be seen by using any other Alt code such as the example below.

Examples of entering pound sign (Alt+0163) and y with diaeresis (Alt+0255)

Here is a sample program that demonstrates this issue for your reference: ListViewEditTestWindow Compile it as ANSI in 32 bit (x86) mode.

The bug only happens when the Edit control is subclassed (after obtaining the HWND handle from the LVN_BEGINLABELEDIT notification) by using the older way of subclassing using SetWindowLongPtr with GWLP_WNDPROC.

I have observed that in these cases, two WM_CHAR messages are sent to the Edit control where the wParam contains the UTF-8 bytes of the character. In the pound example, the bytes are 0xA3 and 0xC2. They seem to be in reverse order though, so the first byte comes second.

This behaviour is not observed when using an Edit control in a regular window. It seems to be only when doing an in-place edit on a ListView (perhaps also TreeView but I didn't test that).

This bug is similar to another one I reported a while ago that affects combo boxes.

Versions Tested

  • Windows 10 Pro 22H2
  • Windows 11 Pro 22H2

Workarounds

  • Avoid subclassing the Edit control. Though this is not always possible as one may wish to recieve window messages from the control.
  • Use the newer SetWindowSubclass method of subclassing.
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,761 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 21,491 Reputation points Microsoft External Staff
    2025-04-08T02:47:19.64+00:00

    Hello @David H ,

    Welcome to Microsoft Q&A!

    I was able to reproduce the same behavior and using SetWindowSubclass fixed the issue.

    For your scenario, we recommend that you submit this behavior in Feedback Hub. You could find the Feedback Hub in the Start Menu. Please select Developer Platform->API Feedback as the category when you submit your request. The related team will check the request.

    If this unexpected behavior has a serious business impact, I suggest that you might need to open a support ticket for this. Please contact our paid support at MS Support. You will get 1:1 support on that. Select Developer Tools -> Windows SDK -> Windows SDK for Windows 10 ->Desktop app UI development ->Windows management (User32) API and Windows messages in the support page and you could contact the team. Please kindly note that your support ticket will be free if it is Microsoft's issue.

    Thank you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.