microsoft/terminal

Sending unicode character via KEYEVENTF_UNICODE/VK_PACKET in SendInput outputs the wrong characters

jtroo opened this issue · 5 comments

jtroo commented

Windows Terminal version

1.12.10982.0

Windows build number

10.0.19043

Other Software

Reproducible in:

  • cmd.exe
  • wsl ubuntu 20.04

powershell just displays ?? , not sure which behaviour is more incorrect

Uses SendInput:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput

Steps to reproduce

Via SendInput, send the unicode character 🙁

E.g. in
https://github.com/jtroo/kanata/blob/master/src/oskbd/windows.rs#L168

Expected Behavior

The correct unicode value gets typed in: 🙁

Actual Behavior

The characters 翿翿 are typed in instead

Additional info

When copy-pasting the unicode character, it's rendered correctly (in cmd/wsl). It's just not typed correctly via SendInput.

the problem still appear.

,: => 翿

image

In conhost (the old terminal) this issue is caused by COOKED_READ_DATA and will take a while to fix (and it's outside of the scope of this issue).

In Windows Terminal I've narrowed this down to being caused by the Win32 Input Mode. You can work around this issue by adding "experimental.input.forceVT": true in your settings.json file (in the global global scope - this setting isn't per profile).

Edit: This is caused by MAX_PARAMETER_VALUE clamping the character parameter to 0x7fff.

🎉This issue was addressed in #13667, which has now been successfully released as Windows Terminal v1.14.228.:tada:

Handy links:

🎉This issue was addressed in #13667, which has now been successfully released as Windows Terminal Preview v1.15.228.:tada:

Handy links: