Skip to content

[BUG] UTF-8 Corruption Bug #1716

Description

@sumlin

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other: Anthropic Max subscription
  • Claude CLI version: 1.0.16 (Claude Code)
  • Operating System: Archlinux Linux 6.14.7-arch2-1 x86_64
  • Terminal: Konsole
  • Python: 3.13.3
  • Locale: en_US.UTF-8 (properly configured)
  • Tool: Claude Code Write tool

Bug Description

The Claude Code Write tool that causes Unicode corruption, resulting in data loss for non-English content. This issue affects file operations and impacts user workflows sometimes.

Problem Summary

The Write tool occasionally corrupts Unicode characters when creating files, specifically:

  • Russian Cyrillic text becomes unreadable gibberish (Dialog-First ?>4E>4** - 15+ ?0BB5@=>2 B@8335@>2 4;O 02B><0B8G5A:>3> >1=0@C65=8O 206=>9 8=D>@<0F88)
  • Emoji are replaced with control characters
  • English text remains unaffected
  • Issue occurs "time to time" (intermittent but recurring)

Impact

This bug causes actual data corruption requiring manual file recovery. For users working with non-English content, this represents a significant reliability issue that affects productivity and trust in the tool.

Technical Details

I have prepared a comprehensive bug report with:

  • Complete system environment details
  • Technical analysis of the corruption pattern
  • File examples (corrupted vs corrected)
  • Hex dumps and encoding analysis
  • Reproduction information
  • Root cause hypothesis

The evidence suggests UTF-8 bytes are being incorrectly interpreted as CP1251/Windows-1251 encoding during file write operations, likely due to a race condition or intermittent encoding handling bug.

Steps to Reproduce

  1. Using Write() utility when writing non-Cyrillic characters (very rare)

Expected Behavior

  • 🔍 Dialog-First подход - 15+ паттернов триггеров для автоматического обнаружения важной информации
  • 🔄 Smart Update логика - интеллектуальная обработка изменений (ADD, UPDATE, DELETE, MERGE)
  • 🗣️ Natural Language навигация - естественное взаимодействие ("покажи вчерашнее обсуждение")

Actual Behavior

  • =
    Dialog-First ?>4E>4
    - 15+ ?0BB5@=>2 B@8335@>2 4;O 02B><0B8G5A:>3> >1=0@C65=8O 206=>9 8=D>@<0F88
  • =� Smart Update ;>38:0 - 8=B5;;5:BC0;L=0O >1@01>B:0 87<5=5=89 (ADD, UPDATE, DELETE, MERGE)
  • =ã� Natural Language =02830F8O - 5AB5AB25==>5 2708<>459AB285 ("?>:068 2G5@0H=55 >1AC645=85")

Additional Context

Important! Claude Code is able to fix this error on his own if he sees that something is written incorrectly in the file. But once he suspended the work saying that I was violating the rules of using the application, stating as a reason that I was allegedly trying to exploit vulnerabilities (lol)

report_unicode.md - detailed description
README.md
README_corrupted.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolsbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions