Skip to content

/copy in TUI produces garbled CJK text on WSL2 #35107

@gomico

Description

@gomico

Describe the bug

When using the /copy command in a WSL2 environment, copying Chinese/non-ASCII text results in garbled characters when pasted on the Windows side.

For example, copying 你好世界,测试中文 produces garbled output like 浣犲ソ涓栫晫锛屾祴璇曚腑鏂 — UTF-8 bytes reinterpreted as the system's ANSI code page (CP936 on Chinese Windows).

To Reproduce

  1. Run hermes --tui inside WSL2 (Windows Terminal)
  2. Ask the agent to output Chinese text
  3. Use /copy to copy the text
  4. Paste (Ctrl+V) into any Windows application (Notepad, browser, etc.)

Expected behavior

All Unicode characters should be preserved correctly in the clipboard.

Environment

  • OS: Windows 11 with WSL2 (Ubuntu)
  • Terminal: Windows Terminal
  • Hermes version: 0.15.1
  • Windows system locale: Chinese (code page 936)

Additional context

Affects all non-ASCII characters — CJK, emoji, accented characters, etc. The text displays correctly in the TUI itself, but becomes garbled after /copy and paste. The clipboard write goes through powershell.exe Set-Clipboard, where the piped stdin is decoded using the system's default code page instead of UTF-8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/tuiTerminal UI (ui-tui/ + tui_gateway/)type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions