Copy button copies garbled Chinese text for long terminal chat messages

Open 💬 1 comment Opened Jun 13, 2026 by sun-binwen

What happened?

In the Codex terminal chat UI, Chinese text sometimes displays correctly on screen, but the built-in copy button or /copy action copies garbled text.

Example observed by the user:

Displayed text looks correct:

我建议下一步...

Copied text becomes mojibake:

æ^H^Q建议ä¸^Kä¸^@æ­¥ä...

This appears to happen more often with long assistant responses containing Chinese / CJK text. The terminal rendering is correct, but the clipboard content is corrupted.

Expected behavior

The copied text should exactly match the displayed Chinese text.

Actual behavior

The displayed Chinese text is correct, but the copied clipboard text becomes garbled.

Why this looks like an encoding/copy-path bug

The corrupted output looks like UTF-8 bytes decoded as Latin-1 / Windows-1252. This suggests the renderer and clipboard serialization may be using different buffers or encodings.

Possible affected area

  • Codex terminal / TUI chat
  • Built-in copy button
  • /copy action
  • Long wrapped CJK messages
  • Clipboard serialization / ANSI stripping / terminal scrollback copy path

Related issue found before filing

A web search found a related older report for the VS Code IDE plugin: #4235, "copying a Chinese response from GPT results in garbled text." This report is specifically about the Codex terminal chat UI /copy or built-in copy path where display is correct but copied text is mojibake.

Impact

This makes long Chinese responses difficult to reuse for notes, reports, feedback, or documentation. It is especially confusing because the message displays correctly, but the copied result is corrupted.

Suggested fix

Ensure the copy action reads from the original UTF-8 message text rather than a rendered terminal buffer, and add a regression test for long wrapped CJK responses.

Environment

Exact Codex version and platform were not captured in this side report. The user observed this in a terminal chat session using Chinese text and the built-in copy or /copy action.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗