Investigating Unicode Lookalikes in Claude Code File Paths

March 31, 2026

Abridged English translation. This edition retains the incident, Unicode diagnostics, defensive handling, and subsequent evidence. Sections detailing attack construction, evasion, and poisoning experiments have been omitted.

I ran into a misleading problem while using Claude Code. Paths in tool calls looked correct, yet Read, Write, and Edit failed. Write reported EACCES: permission denied, while Read and Edit could report that a file did not exist. What appeared to be the same logical path sometimes worked and sometimes failed.

The difference was in the path string. The generated file_path contained Cyrillic characters, some of which closely resemble Latin letters. The operating system received a different path. When the tool tried to create the nonexistent root directory, it could then fail for lack of permission.

On March 31, 2026, I filed the report as S2thend. My environment was Claude Code 2.1.88, Opus, and macOS, using the Anthropic API. The report records what I observed in the conversation and the generated tool arguments. Issue #41422

A successful Read in Claude Code is followed by File not found for Edit and repeated EACCES errors for Write. The user points out non-ASCII characters in the path.

Screenshot saved on March 31, 2026, cropped and compressed to JPEG. After Read succeeded, Edit still reported a missing file, while Write repeatedly reported insufficient permission to create what looked like the /workspaces directory. I pointed out the character issue in the conversation. The screenshot preserves the appearance, but identifying particular code points requires the original path string.

I began wondering what models, compilers, filesystems, and browsers see in text that looks identical to us. The original article is archived under the issue date. Developments after March 2026 appear in the postscript.

The same-looking letter can have different identities

These characters are often called homoglyphs. Unicode security specifications use the broader term confusables for characters or strings that look sufficiently alike to be mistaken for one another, even if they are not identical in every font. Unicode Technical Standard #39, revision 32

Latin characterCode pointCyrillic characterCode point
aU+0061аU+0430
cU+0063сU+0441
eU+0065еU+0435
oU+006FоU+043E
pU+0070рU+0440

Cyrillic is a writing system used by Russian, Ukrainian, and other languages. The characters themselves are perfectly ordinary. The problem arises when a field calls for one specific character and receives a visually similar one.

Three levels matter. A Unicode code point identifies a character. UTF-8 specifies how to encode code points as bytes. A glyph is what the font and renderer draw. Unicode encodes characters, independently of their appearance in one font. The Unicode Standard, chapter 2

For the two letters that look like o, the Latin character's UTF-8 bytes are 6f, and the Cyrillic character's bytes are d0 be. Both are valid UTF-8. A decoder has no reason to report that the latter occurs in an English path, and saving the file again as UTF-8 won't turn it into the Latin letter.

The phenomenon extends beyond different scripts. Uppercase I and lowercase l are similar in some fonts, and two characters, rn, can resemble a single m. Zooming or changing fonts can help, but neither substitutes for checking the characters.

In a browser, the exact domain determines the identity under which a connection is established. Internationalized domain names support non-Latin writing systems, and Punycode represents non-ASCII labels in ASCII. Browsers apply display policies when deciding whether to show a Unicode label or its xn-- form. A valid HTTPS certificate identifies the domain to which the connection was made. It cannot establish that the user intended a different, similar-looking domain. Chromium documentation on internationalized domain names

In source review, two names that look the same can refer to different objects. Language-specific identifier rules determine what identifiers mean. Human readers see glyphs laid out by a renderer, while a model receives a representation produced by preprocessing and tokenization. A tiny visible difference may therefore change the machine's input. Studies of deliberately perturbed input do not establish why an identifier generated by a model contains an unexpected character. Python identifier rules · Unicode source code handling

Several text problems that look alike

Searching for Claude and Cyrillic turns up many reports of “corruption,” but they can describe different failures.

SymptomExampleWhat to inspect
A lookalike appearsLatin o becomes valid Cyrillic оActual code points in tool arguments and the first place they appear
Decoding or write corruptionNormal text becomes garbled or shows �Original bytes, decoding, and read/write boundaries
A model's description differs from the fileThe file is fine but the model claims it saw garbled textThe file, tool output, and model's description
Display misalignmentHighlighting is shifted relative to the wordRendering, index calculations, and whether the underlying characters actually changed

Following a Reddit discussion led me to Paul Tero's 2012 Unicode, UTF8 & Character Sets: The Ultimate Guide. It follows text through servers, browsers, and databases, explaining character sets, Unicode, UTF-8, and garbled output. It is helpful background on the processing chain. I use Unicode's own materials for the technical definitions.

Several Reddit readers reported that special characters in the article itself were displayed incorrectly. A reader observed that the web page was already returning ordinary question marks, ? (U+003F). Others later reported a fix. Those comments record observations, but cannot identify the component where the loss occurred or establish that the database caused it.

If a character has already been replaced with a question mark, correctly decoding subsequent bytes cannot restore it. In my case the Cyrillic character could be encoded and transmitted perfectly, and the filesystem would still receive a different path. Check both whether the data was damaged and whether the intact string was the one you intended.

One report said Write intermittently corrupted Cyrillic text and emoji: the author supplied session log excerpts and said the input looked right but the file differed. That suggests inspecting the tool execution boundary. In my report the path was already wrong in the tool arguments. Another user said a German file displayed normally but Claude claimed to see für instead of für. A third report concerned terminal highlighting around non-ASCII characters. These observations call for different checks. Compare the original file on disk, what the tool read, what arguments the model generated, and what the tool ultimately wrote. A screenshot or the model's account of an “encoding error” cannot by itself distinguish the cases. Write report · German file report · Highlighting report

Why might the error appear repeatedly?

Repeated lookalikes might raise questions about training data, but investigation also needs to cover inference infrastructure, external inputs, and propagation within a conversation. They can produce similar visible effects and require different evidence.

Inference infrastructure can produce unusual characters

On September 17, 2025, Anthropic published A postmortem of three recent issues. A runtime optimization deployed to Claude API TPU servers on August 25 occasionally assigned high probabilities to tokens that should have had very low probabilities. English answers could contain Thai or Chinese characters or clearly invalid code syntax. It affected some Opus 4, Opus 4.1, and Sonnet 4 requests at the time, with no reported impact on third-party platforms. Anthropic said it reverted the change on September 2 and added detection for abnormal character output. That was an identified inference-time implementation fault. The postmortem did not link it to my 2026 path report. Anthropic's postmortem

An accidental data error is distinct from intentional manipulation. Wrong characters in examples, mismatched training pairs, and an evaluator that overlooks character distinctions are all possibilities to investigate. Showing something is wrong with the data would still leave the question of intent. The fact that a vendor updates and trains models does not mean a running model changes its weights on each turn. Nor does a model copying an incorrect path from a file by itself establish that the file contained an instruction diverting it from its task.

Propagation within a conversation remains a hypothesis

An incorrect path may enter context, be copied in a later answer, come back in a tool error, and survive in a conversation summary or project note. This could continue influencing generation without any weight update. It would explain how an error persists, without identifying the origin of the first incorrect character.

The NeurIPS 2022 paper Learning to Break the Loop found a self-reinforcing effect for repeated sentences: more appearances in context made another occurrence more likely. Repetition Neurons (2025) found neurons related to repetition in four pretrained language models whose activity increased as repetition continued. Anthropic's In-context Learning and Induction Heads investigated copying and completing patterns from preceding sequences. Its causal evidence is more direct for small models, with limits on generalization to large ones.

These studies do not directly establish that one lookalike causes more substitutions elsewhere. Copying one wrong path ten times is different from ten previously correct words acquiring new substitutions. A longer conversation can contain more anomalous characters simply because it contains more output. Count newly introduced changes separately from copies and relate the number to output length before concluding that the error rate rose. A cluster of reports following an update calls for comparisons across versions, clients, platforms, and independent sessions. The number of reports cannot identify a cause.

For my own case I would locate the first anomalous code point in complete logs and compare what happened before and after context compaction. Attribution to training would require training data and checkpoints. Attribution to the inference service would require its request and deployment records. The confirmed observation is an incorrect character in a tool argument. The report did not establish training poisoning, an infrastructure fault, propagation in context, or proximity between multilingual token embeddings as the root cause.

Inspect code points before deciding how to handle them

This Python example displays the position, name, and bytes of non-ASCII characters. It only examines a string and does not read or change files. In an investigation, replace actual with the original file_path parsed from the log.

import unicodedata

expected = "/workspaces/demo/src/file.py"
actual = "/w\u043erks\u0440\u0430\u0441\u0435s/demo/src/file.py"

print("same:", actual == expected)
print("escaped:", ascii(actual))

for index, char in enumerate(actual):
    if not char.isascii():
        print(
            index,
            f"U+{ord(char):04X}",
            unicodedata.name(char, "UNKNOWN"),
            char.encode("utf-8").hex(" "),
        )

One line of output is:

2 U+043E CYRILLIC SMALL LETTER O d0 be

Index 2 contains a different character from the expected Latin o. The ascii() function also makes non-ASCII characters visible as escapes, which helps with copying, comparison, and logging.

The loop lists non-ASCII characters. It does not decide whether they are mistakes or evidence of an attack. Chinese directory names, accented letters, and legitimate Cyrillic filenames may need to be kept intact. Compare the actual string with the project's expectations for the particular object.

NFKC can reconcile some differences

Normalization handles particular kinds of equivalence. These examples distinguish fullwidth, combining, and cross-script characters:

import unicodedata

print(unicodedata.normalize("NFKC", "A") == "A")       # True
print(unicodedata.normalize("NFC", "e\u0301") == "é")  # True
print(unicodedata.normalize("NFKC", "\u043e") == "o") # False

NFKC folds fullwidth A to A. NFC composes e plus a combining acute accent into é. Cyrillic о and Latin o are different characters and have no such normalization equivalence. Applying NFKC to everything would not solve my path problem. Normalization is not lossless for all content, so choose it according to the semantics of the field.

Keep similarity detection separate from object identity

UTS #39 defines a confusable skeleton: an intermediate representation for comparing strings and detecting visual confusion. A skeleton need not be Latin, and is not a corrected filename to display or open. UTS #39

Never silently replace a path just because it looks like another. Both files may really exist, and automatic replacement could send an operation to the wrong object. The same point matters for permissions. If a similar-looking path fails to match a rule, the actual object, any required confirmation, and the operation ultimately allowed still need examination. Treating lookalike paths as identical could incorrectly grant file B the authorization intended for file A. Use similarity to trigger inspection and actual object identity and access policy to decide authorization.

Define character expectations for AI tool calls

In my original issue I proposed path character restrictions, lookalike detection, and argument cleaning. After considering multilingual filenames, I would use a narrower boundary: strictly validate fields that are already specified as ASCII; for others, preserve the input and make unexpected characters visible.

A project might restrict new branch names and environment variable keys to ASCII while allowing Unicode in documents and existing paths. Enforcing such a rule has specific project semantics. Stripping non-ASCII characters throughout a repository would damage legitimate content.

At the tool layer, prefer real paths returned by directory enumeration and minimize the need for a model to retype filenames from prose. Before execution check that the target exists where required and is within the allowed scope. If candidate objects look similar but differ in characters, show their code-point differences before deciding what to do.

Editors and CI can flag identifiers, control characters, and project naming-rule violations in code review. Chinese comments need not be anomalous. Mixed-script identifiers need evaluation under the language's own rules. UTS #55 discusses diagnostics that suit real projects more closely than a blanket ban on non-ASCII. Unicode Technical Standard #55

An instruction in CLAUDE.md can express expectations, such as “preserve the original characters when referring to existing paths; use the project's ASCII convention for new branch names.” Text still depends on the model following it. Inputs that are unacceptable should be rejected by code before the tool executes.

When a path, name, or permission behaves unexpectedly, compare the actual characters first. For an agent that turns text into filesystem operations, character-level accuracy determines which object it will act on.

Postscript, November 13, 2026

A bot closed my issue for inactivity on May 5. The closure did not confirm a fix. On June 8 another user reported that it was still happening and linked a branch-name report. Two May issues used the same example word, redeплoys, and similar accounts of the agent's own explanation involving session summaries. They cannot be counted as independent reproductions on that basis, and attributing the problem to compaction requires logs and implementation evidence. A June report described a Cyrillic м in a generated Git branch name. Similar output in another identifier does not establish a shared internal bug. Original issue · May 6 report · May 7 report · Branch name report

Anthropic's May 7, 2026 paper Natural Language Autoencoders Produce Unsupervised Explanations of LLM Activations investigated early Opus 4.6 checkpoints switching to another language in response to all-English prompts. Internal activations suggested that the model might be inferring the user's native language incorrectly. Researchers hypothesized that some supervised fine-tuning pairs contained questions translated into English with answers mistakenly left in the original language. They then found training examples matching that description. Original research, “Language Switching”

That combines internal activation evidence with actual training data and is stronger evidence than asking a chat model why it suddenly spoke Russian. It supports a connection between erroneous training pairs and language switching. It does not demonstrate malicious poisoning or explain Cyrillic characters within English paths. A whole answer changing languages and a word containing mixed scripts still need separate investigations.

© 2026 borui. All rights reserved. This content may be freely reproduced, displayed, modified, or distributed with proper attribution to borui and a link to the article: borui (2026-03-31). Investigating Unicode Lookalikes in Claude Code File Paths. https://caiborui.com/blog/2026-03-31-zh-claude-code-cyrillic-homoglyphs-entrans

@misc{borui2026-564eef0c,
  author = {borui},
  title = {{Investigating Unicode Lookalikes in Claude Code File Paths}},
  year = {2026},
  publisher = {borui's blog},
  url = {https://caiborui.com/blog/2026-03-31-zh-claude-code-cyrillic-homoglyphs-entrans}
}