Menu

#614 Incorrect decoding of character in event handlers (regression in 6.40)

8
pending
1
2026-04-02
2025-06-17
No

After the introduction of the new Windows message dispatch machinery in 6.40, decoding of the character argument sent with WM_CHAR, WM_DEADCHAR, WM_SYSCHAR and WM_SYSDEADCHAR is not correct. In particular, a signed char is sign-extended to 32 bits in the conversion to uint. See TDispatch<WM_CHAR>.

For example, character 252 ('ü' in the Windows-1252 code page) has the value -4 as a signed char, which is then converted to uint giving the value 4294967292.

Reported by @floele [discussion:bc53547f03].

Workaround

Cast the parameter ch to tchar before use. For example:

void TMyClass::EvChar(uint ch, uint repeatCount, uint flags)
{
  switch (static_cast<tchar>(ch))
  {
  case _T('ü'): // Character 252 (-4 signed) in Windows-1252 code page.
  // ...
  }
}

Related

Discussion: bc53547f03
Discussion: How to handle EvChar with umlauts?
Wiki: OWLNext_Roadmap_and_Prereleases

Discussion

  • Vidar Hasfjord

    Vidar Hasfjord - 2025-06-17
    • status: open --> pending
     
  • Vidar Hasfjord

    Vidar Hasfjord - 2025-06-17

    This issue was fixed in [r7899].

     

    Related

    Commit: [r7899]

  • Vidar Hasfjord

    Vidar Hasfjord - 2026-04-02
    • labels: Internal, Dispatch --> Internal, Dispatch, Regression
     

Log in to post a comment.

MongoDB Logo MongoDB