locale-encoding

locale-encoding is an agent for coding agents from NickZaitsev/ru-normalizr. It costs 0 tokens per session (390 once invoked), scanned A, original, MIT.

Rules for handling text encodings, the formats computers use to store and display characters, across Windows and Linux environments.

In plain words
What is it for?
They guide UTF-8 handling in file operations, subprocesses, standard output, and tests that reproduce the Windows CI environment.
Why use it?
They prevent Cyrillic and other non-English text from working locally but failing in English Windows CI, especially when files or command output rely on the machine's default encoding.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/nickzaitsev/ru-normalizr/locale-encoding
Clone the repo
git clone --depth 1 https://github.com/NickZaitsev/ru-normalizr

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for locale-encoding

README.md
[![agentmods](https://agentmods.dev/badge/agents/nickzaitsev/ru-normalizr/locale-encoding.svg)](https://agentmods.dev/agents/nickzaitsev/ru-normalizr/locale-encoding)
Your own site
<a href="https://agentmods.dev/agents/nickzaitsev/ru-normalizr/locale-encoding"><img src="https://agentmods.dev/badge/agents/nickzaitsev/ru-normalizr/locale-encoding.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 390 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00390
Opus 5 $0.00000 $0.00195
Sonnet 5 $0.00000 $0.00078
Haiku 4.5 $0.00000 $0.00039

Measured 5d ago against content hash 5de6a4ce98f2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

locale-encoding scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

`write_text()`, and to `subprocess.run()` when capturing text. Never rely on
docs/agents/locale-encoding.md · 30 lines

What it actually says

Locale encoding and the Windows CI cell

The windows-latest CI runner is an English Windows image, so locale.getencoding() there is cp1252, which cannot represent Cyrillic at all. The primary development machine is a Russian Windows install with cp1251, which can. Ubuntu cells are UTF-8.

This makes a whole class of bugs invisible locally: anything that falls back to the locale encoding works on cp1251 and on Linux, and fails only on the CI Windows cell. "It passes on my Windows machine" is therefore not evidence.

It has already happened once. The CLI wrote its result with sys.stdout's locale encoding while --file/--output were pinned to UTF-8, so redirecting CLI output on cp1252 died with UnicodeEncodeError and every CLI test failed on windows-latest only.

Rules

  • Always pass encoding="utf-8" explicitly to open(), read_text(), write_text(), and to subprocess.run() when capturing text. Never rely on text=True alone — it decodes with the locale encoding.
  • __main__.py calls _use_utf8_stdio() first thing in main(); keep any new stream it touches UTF-8 too.
  • To reproduce the CI environment on any platform, force the child's encoding: subprocess.run(..., env=dict(os.environ, PYTHONIOENCODING="cp1252")). See test_cli_emits_utf8_under_a_non_cyrillic_locale_encoding in tests/test_api.py.
  • To find latent cases, run the suite with PYTHONWARNDEFAULTENCODING=1 and look for EncodingWarning outside site-packages.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 30 lines · 0 tokens per session scan A 5de6a4ce98f2

Subscribe to this mod's changes

locale-encoding is an agent published in the GitHub repository NickZaitsev/ru-normalizr (22 stars, last pushed 28d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 390 tokens. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.