[BUG] /copy command corrupts UTF-8 characters on Windows again (regression from #22346)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The /copy command corrupts all non-ASCII characters (Japanese/CJK) when copying to the Windows clipboard. The response.md file contains correct UTF-8 text, but the clipboard content is garbled (mojibake).
Example clipboard output:
���m�������܂����B
�ł́A���L�̓���猟�������iTRANSFER_CD LIKE ''�j���폜�������܂��B
What Should Happen?
Japanese text should be correctly copied to the clipboard, as it was in v2.1.70–v2.1.75.
Error Messages/Logs
(No error messages — the command reports success but the clipboard content is corrupted)
Steps to Reproduce
- Run Claude Code on Windows with a non-English locale (e.g., Japanese)
- Get a response containing Japanese characters
- Run /copy
- Paste from clipboard — Japanese characters are garbled
- Open the response.md file written by /copy — content is correct UTF-8
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Last Working Version: 2.1.75 (confirmed working in #22346 comments)
Claude Code Version
2.1.88
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
This is a regression of #22346, which was fixed in v2.1.70 by switching to PowerShell's Set-Clipboard.
Environment details:
- Windows 11 Pro (10.0.26200)
- Shell: Git Bash
- PowerShell [Console]::OutputEncoding.CodePage: 932 (Shift_JIS)
- $LANG: ja_JP.UTF-8
Workaround:
powershell -Command "Get-Content '$env:TEMP\claude\response.md' -Encoding UTF8 -Raw | Set-Clipboard"
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗