Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surrogate pairs are ignored on Windows Terminal #848

Open
kazatsuyu opened this issue Dec 7, 2023 · 1 comment · May be fixed by #857
Open

Surrogate pairs are ignored on Windows Terminal #848

kazatsuyu opened this issue Dec 7, 2023 · 1 comment · May be fixed by #857

Comments

@kazatsuyu
Copy link

Describe the bug

On Windows Terminal, characters represented by UTF-16 surrogate pairs are not decoded properly and are ignored.

To Reproduce

  1. Run the code https://gist.github.com/kazatsuyu/d112afeebac0490efac267bbf2355f84 on Windows terminal.
  2. Copy and paste "abc🐈def".
  3. Confirm that the 🐈 is not displayed.

Expected behavior

The 🐈 is displayed.

OS

Windows 11 22621.2428

Terminal/Console

Windows Terminal

@kazatsuyu kazatsuyu changed the title Windows Terminalでサロゲートペアが無視される Surrogate pairs are ignored on Windows Terminal Dec 7, 2023
@kazatsuyu
Copy link
Author

I made a small modification to crossterm_winapi to allow it to display low-level input events.
Windows Terminal seems to send two input events for surrogate pairs, one with key_down: true and one with key_down: false.
image

When input from the console displayed by AllocConsole, only the one with key_down: false is sent.
image

If one of consecutive upper surrogates and the lower surrogate in the absence of an upper surrogate were ignored, it would be possible to handle this kind of input pattern.

@kazatsuyu kazatsuyu linked a pull request Jan 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant