Skip to content

Edit tool replaces Turkish UTF-8 characters with ASCII equivalents #13939

Description

@morphaven

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When using the Edit tool to modify files containing Turkish UTF-8 characters, Claude Code systematically replaces Turkish special characters with their ASCII equivalents:

  • ş → s
  • ı → i
  • ğ → g
  • ü → u
  • ö → o
  • ç → c
  • Ş → S
  • İ → I
  • Ğ → G
  • Ü → U
  • Ö → O
  • Ç → C

This happens both when:

  1. Adding new content that contains Turkish characters
  2. When the edit touches existing Turkish text in the file

The corruption occurs silently without any warning, causing data loss and requiring manual fixes.

What Should Happen?

Claude Code should preserve all UTF-8 characters exactly as they appear in the source content. Turkish characters (and other non-ASCII Unicode characters) should remain unchanged when:

  1. Reading files with Turkish content
  2. Editing files that contain Turkish characters
  3. Writing new content that includes Turkish characters

The Edit tool should be encoding-aware and maintain byte-for-byte accuracy for all UTF-8 content.

Error Messages/Logs

Steps to Reproduce

  1. Create a file with Turkish content:

    // test.ts
    const message = 'Merhaba dünya! Türkçe karakterler: şğüöçı'
  2. Ask Claude to edit the file (e.g., "add a console.log statement"):

    claude "Add a console.log to print the message in test.ts"
    
  3. After the edit, check the file content:

    // Result - Turkish characters are corrupted:
    const message = 'Merhaba dunya! Turkce karakterler: sguoci'

Real-world example from my session:

  • Original file had: 'PWA (Progressive Web App) özellikleri kapsamlı şekilde geliştirildi'
  • After Claude's edit: 'PWA (Progressive Web App) ozellikleri kapsamli sekilde gelistirildi'

The issue is 100% reproducible with any file containing Turkish characters.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.69 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

Impact

This bug affects all non-English languages that use special UTF-8 characters, including but not limited to:

  • Turkish (ş, ğ, ı, ü, ö, ç)
  • German (ä, ö, ü, ß)
  • French (é, è, ê, ë, à, ç)
  • Spanish (ñ, á, é, í, ó, ú)
  • Portuguese, Polish, Czech, and many others

Workaround

Currently, users must manually review and fix all edited files after each Claude Code operation, which is time-consuming and error-prone.

Hypothesis

The issue may be related to:

  1. Character encoding during file read/write operations
  2. Internal string normalization that converts to ASCII
  3. A tokenization or processing step that strips non-ASCII characters

Notes

  • The bug is 100% reproducible
  • Affects both the Edit and Write tools
  • Happens regardless of file type (.ts, .tsx, .js, .json, .md, etc.)
  • File encoding is UTF-8 with proper BOM

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corearea:toolsbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:windowsIssue specifically occurs on WindowsstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions