claude-code - 💡(How to fix) Fix [Bug] /copy command corrupts UTF-8 text to latin-1 mojibake in clipboard write

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description /copy corrupts non-ASCII text (UTF-8 → latin-1 mojibake) in 2.1.169 — regression.

Repro: /copy any text with chars ≥ U+0080 (e.g. "configuración → §"), paste → mojibake. ASCII is unaffected. Env: WSL2 + VS Code integrated terminal (TERM_PROGRAM=vscode), DISPLAY=:0, WAYLAND_DISPLAY=wayland-0; only xclip on PATH (no wl-copy/xsel); locale C.UTF-8. Evidence the bug is in the clipboard WRITE encoding, not the source:

  • /copy's own dump file (/tmp/claude-*/copy.txt) is correct UTF-8 (verified by hexdump: ó=c3 b3, §=c2 a7, →=e2 86 92).
  • Re-publishing that same file via xclip -selection clipboard -t UTF8_STRING pastes correctly → corruption is introduced when /copy writes the clipboard (likely OSC-52 base64 built from a latin1 string, or xclip invoked without the UTF8_STRING target). Confirmed regression: a long-lived session on the prior build copies the same text cleanly; only 2.1.169 mangles it.

Environment Info

  • Platform: linux
  • Terminal: vscode
  • Version: 2.1.168
  • Feedback ID: 7b04a4f7-48dc-4465-a962-d5a43ff1b662

Errors

[]

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING