C:/Program Files/Git/copy command corrupts UTF-8 characters on Windows

Status Closed — not planned
Maintainer reply None cached
Activity 7 comments · opened Feb 1, 2026 · closed May 11, 2026

Description

The /copy command in Claude Code corrupts UTF-8 characters when copying to Windows clipboard.

Environment

  • OS: Windows 10/11
  • Terminal: Windows Terminal / PowerShell
  • Claude Code version: latest

Steps to Reproduce

  1. Have Claude generate text with non-ASCII characters (e.g., Romanian diacritics: ă, ț, ș, î, â)
  2. Include box-drawing characters (├, └, │, ─) in the output
  3. Use /copy to copy the message
  4. Paste into any text editor

Expected Behavior

Characters should be preserved exactly as displayed in the terminal.

Actual Behavior

Characters are corrupted (mojibake):

  • ă─â
  • ț╚Ť
  • ș╚Ö
  • ├──ÔöťÔöÇÔöÇ
  • └──ÔööÔöÇÔöÇ

Example

Original (in terminal):

Excelentă observație
├── Item 1
└── Item 2

After /copy + paste:

Excelent─â observa╚Ťie
ÔöťÔöÇÔöÇ Item 1
ÔööÔöÇÔöÇ Item 2

Root Cause

Windows clipboard uses different encoding (CP-1252 or UTF-16) than UTF-8 used in the terminal. The /copy command likely doesn't explicitly encode as UTF-8 when writing to clipboard.

Suggested Fix

Use explicit UTF-8 encoding when copying to clipboard on Windows, possibly via pyperclip with proper encoding or Windows API with CF_UNICODETEXT format.

View original on GitHub ↗

7 Comments

shostako · 6 months ago

I'm experiencing the same issue on a Japanese Windows environment.

Environment:

  • OS: Windows 11 (Japanese locale, system codepage CP932/Shift-JIS)
  • Terminal: WezTerm
  • Claude Code: v2.1.63

Reproduction:

  1. Claude generates a response containing Japanese text and markdown tables
  2. Run /copy
  3. Paste into Notepad or Microsoft Word

Result:
Japanese text like これは v2.1.63 で追加された becomes garbled as 縺薙l縺ッ v2.1.63 縺ァ霑ス蜉縺輔l縺・. This is the classic pattern of UTF-8 bytes being interpreted as Shift-JIS (CP932).

Analysis:
The /copy command appears to write raw UTF-8 bytes to the Windows clipboard as CF_TEXT (ANSI), rather than using CF_UNICODETEXT (UTF-16). Since the system ANSI codepage on Japanese Windows is CP932, the UTF-8 bytes get misinterpreted.

This affects all non-ASCII characters — not just Romanian diacritics as originally reported, but also CJK characters, box-drawing characters, and any multibyte UTF-8 sequences.

Workaround:
Manual text selection in the terminal (e.g., WezTerm mouse select → auto-copy) preserves encoding correctly.

shostako · 5 months ago

This appears to be fixed in v2.1.70. The release notes state:

Fixed clipboard corrupting non-ASCII text (CJK, emoji) on Windows/WSL by using PowerShell Set-Clipboard

I can confirm that /copy with Japanese text works correctly on v2.1.75 (Windows 11 + WezTerm + WSL). The issue can likely be closed.

jhardin-accumula · 5 months ago

Still present in 2.1.89 (Claude Code)

Windows 11
Windows Terminal
_not_ WSL

AlexandreL04 · 5 months ago

Same issue french language
w11 - Gitbash - MinTTY

github-actions[bot] · 3 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

Tanquebu · 2 months ago

Environment: Windows 11 Pro, PowerShell, Italian locale

Reproduction: Use /copy on any response containing Italian accented characters (à, è, ù, ò, ì). The clipboard content shows garbled sequences: àà , èè, ùù.

Workaround: Set-Clipboard via PowerShell produces correct UTF-8 output for the same text.

Example output from /copy:
separazione delle responsabilità , coerenza, manutenibilitÃ

Expected:
separazione delle responsabilità, coerenza, manutenibilità

Root cause appears to be UTF-8 content written to clipboard using CP437/CP1252 encoding on Windows.

github-actions[bot] · 16 days ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.