[BUG] /copy command mangles UTF-8/Unicode characters in WSL
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?
Description
The native /copy command in Claude Code mangles UTF-8/Unicode characters when running in WSL (Windows Subsystem for Linux). It appears to use clip.exe under the hood, which does not handle UTF-8 encoding properly.
Steps to Reproduce
- Run Claude Code in WSL
- Have Claude output text containing Unicode characters (e.g., emoji, CJK, Arabic, math symbols, accented characters)
- Run
/copy - Paste the clipboard contents
Expected Behavior
All characters should be preserved correctly in the clipboard.
Actual Behavior
Non-ASCII characters are garbled. For example:
| Original | Copied |
|---|---|
| cafe resumer | café résumé |
| 🎉 🚀 💻 | ≡ƒÄë ≡ƒÜÇ ≡ƒÆ╗ |
| こんにちは世界 | πüôπéôπü½πüíπü»Σ╕ûτòî |
| € £ ¥ ₹ | Γé¼ ┬ú ┬Ñ Γé╣ |
| — – … | ΓÇö ΓÇô ΓǪ |
Workaround
Using PowerShell with explicit UTF-8 encoding works correctly:
powershell.exe -NoProfile -Command "Set-Clipboard (Get-Content -Raw -Encoding UTF8 \"$(wslpath -w /path/to/file)\")"
Environment
- Platform: WSL2 (Linux 6.6.87.2-microsoft-standard-WSL2)
- Shell: zsh
What Should Happen?
All characters should be copied to the clipboard exactly as displayed in the terminal, preserving Unicode/UTF-8 encoding.
Error Messages/Logs
Steps to Reproduce
- Run Claude Code v2.1.45 in WSL2
- Ask Claude to output text with Unicode characters (emoji, CJK, accented characters, math symbols, etc.)
- Run /copy
- Paste the clipboard contents somewhere (e.g., a text editor)
- Observe that non-ASCII characters are garbled
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.45
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗