Skip to content

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

@LicuVas

Description

@LicuVas

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workinghas reproHas detailed reproduction stepsplatform:windowsIssue specifically occurs on Windows

    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