claude-code
claude-code copied to clipboard
[BUG] MultiEdit UTF-8 Encoding Bug Report
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [x] Other: Claude Code CLI with MultiEdit tool
- Claude CLI version: 1.0.24 (Claude Code)
- Operating System: Linux (root@build) Alpine Linux ^3.22.0
- Terminal: Fish Shell 4.0.2+
Bug Description
The MultiEdit tool incorrectly handles UTF-8 encoded content when writing files, resulting in corrupted characters (mojibake). Chinese characters and special UTF-8 symbols are replaced with replacement characters (�) in the written files, while the same content displays correctly in the Claude interface.
Steps to Reproduce
- Use Claude Code to create a new markdown file with Chinese content:
MultiEdit prompt/skeleton 3.1.3.md - Include Chinese characters in the content, such as:
- "骨架屏" (skeleton screen)
- "中文文档" (Chinese documentation)
- Special characters like "—" (em dash) or "•" (bullet)
- Save the file using MultiEdit
- Read the file back using:
Read prompt/skeleton 3.1.3.md
Expected Behavior
- File should be saved with proper UTF-8 encoding
- Chinese characters and special symbols should be preserved
- Reading the file should display the same content that was written
Actual Behavior
- Chinese characters are replaced with � (replacement character)
- Special UTF-8 characters are corrupted
- File content shows mojibake when read back
- Example: "骨架屏" becomes "��架��"
Additional Context
Test Case Evidence:
- Claude interface displays: "骨架屏(Skeleton Screen)"
- File contains: "��架��(Skeleton Screen)"
System Encoding:
$ echo $LANG
en_US.UTF-8
File Encoding Check:
$ file -bi "prompt/skeleton 3.1.3.md"
text/plain; charset=utf-8
Workaround: Currently avoiding Chinese characters and using only ASCII in documentation files.
Impact: This bug prevents creating multilingual documentation or using special UTF-8 characters through Claude Code's MultiEdit tool, limiting its usefulness for international users and technical documentation that requires special symbols.
Suggested Fix: Ensure MultiEdit tool explicitly uses UTF-8 encoding when writing files, possibly by:
- Setting encoding explicitly in file write operations
- Using
Buffer.from(content, 'utf8')when handling string content - Ensuring all string transformations preserve UTF-8 encoding
I encountered the same problem, when using Rider, the claude code was still correct when using IDE's difference comparison function, but when I clicked accept, the encoding was incorrect! This issue greatly affects usage and is equivalent to wasting a conversation! Please fix it as soon as possible!!!
MacOS, Vscode and
❯locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
Whenever claudecode writes markdown content, It always writes like this: "�� Workers-Hono (Cloudflare), � Pending:, � Pending:"
I set up corretly locales, Lang stuff. Other AI CLI tools have no issue but only Claudecode.
MacOS cursor:
I got same issue
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/1716
- https://github.com/anthropics/claude-code/issues/5047
- https://github.com/anthropics/claude-code/issues/5111
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
This issue has been automatically closed as a duplicate of #1716.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with Claude Code
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.