[BUG] Language setting does not enforce diacritical marks — accents/cedillas dropped in non-English output

Resolved 💬 13 comments Opened Mar 10, 2026 by alissonlinneker Closed Apr 13, 2026

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 language is set to a language that requires diacritical marks (e.g., "pt-BR", "vi", "fr", "cs"), Claude frequently drops accents, cedillas, and other diacritics from its text output — even though it technically responds in the correct language.

For example, with language: "pt-BR":

| Expected | Actual output |
|----------|---------------|
| informação | informacao |
| não | nao |
| código | codigo |
| sessão | sessao |
| você | voce |

This happens even when CLAUDE.md includes explicit instructions like "NEVER omit accents" with detailed examples. The problem gets significantly worse after context compaction and in long sessions.

Related but distinct from:

  • #32181 (language drift to English — my issue is about accent loss while staying in the target language)
  • #32107 (language ignored in auto-accept phase — different trigger)
  • #1599 (curly quotes clobbering — different character class)

What Should Happen?

When language is set to any locale that requires diacritical marks, Claude should maintain full orthographic correctness — including all accents, cedillas, tildes, umlauts, circumflexes, etc. — in all text output, at all times, including after context compaction.

Error Messages/Logs

No errors — the output is syntactically valid, just orthographically wrong.

Steps to Reproduce

  1. Set language: "pt-BR" in ~/.claude/settings.json (or any language with diacritics)
  2. Optionally add a CLAUDE.md rule reinforcing accent usage
  3. Start a session and work on a coding task — accents will be inconsistent from the start
  4. Continue working until context compaction kicks in
  5. After compaction, accent dropping becomes noticeably worse
  6. Explicitly telling Claude "use accents" fixes it temporarily, but it regresses within a few messages

Root cause investigation

I dug into the compiled CLI source (cli.js) to understand why this happens. Found three contributing factors:

1. The language instruction template is too vague

The function that injects the language setting into the system prompt (around line 6230) generates:

# Language
Always respond in pt-BR. Use pt-BR for all explanations, comments, and communications
with the user. Technical terms and code identifiers should remain in their original form.

There's zero mention of diacritical marks, orthographic correctness, or character fidelity. The model interprets "respond in pt-BR" loosely and treats accent-less Portuguese as acceptable.

2. CLAUDE.md instructions are injected with a weakening disclaimer

The function that wraps CLAUDE.md content (around line 6315) adds:

IMPORTANT: this context may or may not be relevant to your tasks.
You should not respond to this context unless it is highly relevant to your task.

This actively tells the model that CLAUDE.md rules are optional context, not binding directives. So even explicit "NEVER drop accents" rules in CLAUDE.md get deprioritized — the model decides accent rules aren't "highly relevant" to a coding task.

3. Context compaction doesn't carry language rules

The compaction/summarization function (around line 2286) sends conversation history to be summarized without including language or locale instructions. The summarization model has no reason to preserve diacritics in the summary, so the compacted context comes back with degraded text. Subsequent messages inherit this degraded context.

Suggested fix

The language instruction template should explicitly enforce orthographic fidelity. Something like:

# Language
Always respond in ${language}. Use ${language} for all explanations, comments, and
communications with the user. Technical terms and code identifiers should remain in
their original form.

Maintain full orthographic correctness for ${language}, including all required diacritical
marks, accents, cedillas, and special characters. Never produce text that omits characters
required by the language's orthographic rules.

Additionally, the CLAUDE.md disclaimer should not apply to language/formatting rules — these are always relevant regardless of the task.

And the compaction prompt should include the user's language setting so the summarizer preserves proper orthography.

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

2.1.72 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

This affects every language that uses diacritical marks — Portuguese, French, Vietnamese, Czech, Turkish, Spanish, German, etc. The issue is structural in how the language setting is injected and how CLAUDE.md instructions are framed. Happy to help test a fix.

View original on GitHub ↗

This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗