Environment
- Platform (select one):
- Claude CLI version: 1.0.103 (Claude Code)
- Operating System: Windows 11
- Terminal: VSCode
Bug Description
Claude Code does not respect the original file encoding when editing files. It assumes UTF-8 encoding for all operations, which causes character corruption when working with files encoded in other formats like Windows-1252.
Steps to Reproduce
- Open a file that is encoded in Windows-1252 (common for Delphi/Pascal projects)
- Use Claude Code's Edit tool to modify text containing accented characters (e.g., Portuguese: configuração, não)
- The file becomes corrupted with characters like configuração instead of configuração
Expected Behavior
Claude Code should:
- Detect the original file encoding
- Preserve the same encoding when making edits
- Or provide a way to configure the target encoding for edits
Current Workaround
Users must either:
- Accept corrupted characters and manually fix them
- Maintain separate UTF-8 clones of their repositories specifically for Claude Code usage
- Use pre-commit scripts to convert between encodings
Impact
This affects any codebase that uses non-UTF-8 encoding, particularly:
- Legacy Delphi/Pascal projects (Windows-1252)
- Projects with specific encoding requirements
- International projects with accented characters
Technical Details
- Claude Code's Read tool correctly displays Windows-1252 files
- The Edit/Write tools force UTF-8 output regardless of input encoding
- VSCode correctly shows Windows-1252 files when configured properly
- The issue only occurs when Claude Code modifies the files
Environment
- Claude Code version: [current version]
- File encoding: Windows-1252 (ANSI - Latin 1)
- IDE: Delphi XE
- Language: Portuguese (Brazilian) with accented characters
This is a critical issue for maintaining legacy codebases that require specific encodings for compiler compatibility.
Environment
Bug Description
Claude Code does not respect the original file encoding when editing files. It assumes UTF-8 encoding for all operations, which causes character corruption when working with files encoded in other formats like Windows-1252.
Steps to Reproduce
Expected Behavior
Claude Code should:
Current Workaround
Users must either:
Impact
This affects any codebase that uses non-UTF-8 encoding, particularly:
Technical Details
Environment
This is a critical issue for maintaining legacy codebases that require specific encodings for compiler compatibility.