[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
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗