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

Closed
opened 2026-01-31 05:39:34 +00:00 by claunia · 5 comments
Owner

Originally created by @jtroo on GitHub (Apr 25, 2022).

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.

Originally created by @jtroo on GitHub (Apr 25, 2022). ### 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.
Author
Owner

@lhecker commented on GitHub (Apr 27, 2022):

For reference:
🙁: https://www.compart.com/en/unicode/U+1F641
翿: https://www.compart.com/en/unicode/U+7FFF

@lhecker commented on GitHub (Apr 27, 2022): For reference: 🙁: https://www.compart.com/en/unicode/U+1F641 翿: https://www.compart.com/en/unicode/U+7FFF
Author
Owner

@miozus commented on GitHub (Jun 18, 2022):

the problem still appear.

,: => 翿

image

@miozus commented on GitHub (Jun 18, 2022): the problem still appear. ,: => 翿 ![image](https://user-images.githubusercontent.com/35659194/174417340-b56df550-d38b-43f1-aa7f-48c870a5fa16.png)
Author
Owner

@lhecker commented on GitHub (Aug 4, 2022):

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.

@lhecker commented on GitHub (Aug 4, 2022): 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.
Author
Owner

@ghost commented on GitHub (Aug 18, 2022):

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

Handy links:

@ghost commented on GitHub (Aug 18, 2022): :tada:This issue was addressed in #13667, which has now been successfully released as `Windows Terminal v1.14.228`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.14.228) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Aug 18, 2022):

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

Handy links:

@ghost commented on GitHub (Aug 18, 2022): :tada:This issue was addressed in #13667, which has now been successfully released as `Windows Terminal Preview v1.15.228`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.15.228) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17336