Skip to content

Fixes #5453. Fix Windows VT input encoding for IME and non-ASCII characters#5454

Merged
BDisp merged 4 commits into
gui-cs:developfrom
BDisp:issue/5453_windowsVT-input-encoding
Jun 1, 2026
Merged

Fixes #5453. Fix Windows VT input encoding for IME and non-ASCII characters#5454
BDisp merged 4 commits into
gui-cs:developfrom
BDisp:issue/5453_windowsVT-input-encoding

Conversation

@BDisp
Copy link
Copy Markdown
Collaborator

@BDisp BDisp commented May 30, 2026

Fixes

Proposed Changes/Todos

  • Save the current console input code page.
  • Set the console input code page to UTF-8 (65001).
  • Decode VT input using UTF-8.
  • Restore the original console input code page when disposing the driver.

Verified manually by entering Chinese IME characters (腌) before and after the change. Prior to the fix the character was received as ?; after the fix the correct Unicode character is delivered to Terminal.Gui.

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@BDisp BDisp requested a review from tig as a code owner May 30, 2026 19:53
@tig tig requested a review from Copilot May 31, 2026 22:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Windows ANSI/VT driver input decoding on Windows when the console input code page is not UTF-8, improving IME and non-ASCII character handling (Fixes #5453).

Changes:

  • Add SetConsoleCP(65001) support to force the console input code page to UTF-8 while using Windows VT input.
  • Track and restore the original console input code page during driver teardown.

Comment thread Terminal.Gui/Drivers/WindowsHelpers/WindowsVTInputHelper.cs
Comment thread Terminal.Gui/Drivers/WindowsHelpers/WindowsVTInputHelper.cs Outdated
Comment thread Terminal.Gui/Drivers/WindowsHelpers/WindowsVTInputHelper.cs Outdated
BDisp and others added 3 commits June 1, 2026 00:10
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@BDisp BDisp merged commit 721d388 into gui-cs:develop Jun 1, 2026
13 checks passed
@BDisp BDisp deleted the issue/5453_windowsVT-input-encoding branch June 1, 2026 04:24
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 this pull request may close these issues.

# Fix Windows VT input encoding for IME and non-ASCII characters

3 participants