[BUG] Claude Code corrupts accented characters (ISO-8859-1 encoding issue)
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?
When Claude Code edits files containing accented Portuguese characters (such as ç, ã, é, í, etc.), it corrupts them, replacing those characters with strange symbols like “�”.
This happens even when the file is saved in ISO-8859-1 encoding.
Example:
//Centraliza o botão dentro do panel
becomes:
//Centraliza o bot�o dentro do panel
The problem affects the entire file — not only the modified sections.
<img width="331" height="27" alt="Image" src="https://github.com/user-attachments/assets/25cb8f6b-eaf1-4f96-91d6-c144e1e6e01e" />
What Should Happen?
Claude Code should preserve ISO-8859-1 encoding and keep all accented characters intact after editing the file.
Error Messages/Logs
Steps to Reproduce
Create a file test.pas (or .py, .js, etc.) with the following content:
//Centraliza o botão dentro do panel
procedure Teste();
begin
ShowMessage('Ação executada com sucesso!');
end;
Run any Claude Code command that modifies the file, for example:
claude "add explanatory comments to the code"
Check the result in your editor — accented characters appear corrupted like “�”.
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.0.28
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
15 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
👎
👎
Can't believe they just don't care about this serious issue.
👎
Anyone?
Has anyone managed to solve this?
👎
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
👎
I am currently getting this with anything i upload, specifically em dashes, arrows and ü.
I solved this problem by asking it to generate a PowerShell script with the encoding I wanted, and then it stopped crashing.
Had the same problem with Delphi projects - Windows-1251 files getting destroyed on every edit.
I ended up building an MCP server that auto-detects file encoding and preserves it when reading/writing. Works as a drop-in replacement for the built-in file tools in Claude Code.
https://github.com/dimitar-grigorov/mcp-file-tools
Not a fix for the core issue obviously, but it stops the corruption until this gets addressed properly.
I was having the same issue as @dimitar-grigorov, but in my case we're working in Japanese with Shift JIS / CP932 encoded files. I also ended up making an MCP server to replace the native Read/Edit/Grep/Write tools. You can find it here
https://github.com/MichaelCharles/cp932-tools-mcp-server
It's been working great for me so far.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
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.