Encoding Fix

Mojibake repair for double/triple encoded UTF-8. Fixes Windows cp1252/Latin-1 misinterpretations. Zero dependencies.

ellmos-ai fceb2b2 1.2 KB Updated

File contents

English — Official English version of encoding-fix.

Encoding Fix (English)

Repairs mojibake (double/triple encoded UTF-8) caused by Windows cp1252/Latin-1 misinterpretation. Zero dependencies — Python stdlib only.

Typical Problem

"ue" (U+00FC) -> UTF-8 \xc3\xbc -> read as cp1252 -> "ü"

Usage

As Library

from encoding_fix import sanitize_outbound

clean = sanitize_outbound("Würge")  # -> "Wuerge"

Subprocess Output

from encoding_fix import sanitize_subprocess_output

text = sanitize_subprocess_output(process.stdout)

CLI

python encoding_fix.py "Würge"    # Check a single string
python encoding_fix.py              # Self-test

Features

  • Idempotent: Correctly encoded text is not modified
  • Up to 3 rounds: Repairs even triple-encoded strings
  • Subprocess decoder: UTF-8/cp1252 fallback for process output
  • Zero dependencies: Python stdlib only

Changelog

1.0.0 (2026-03-12)

  • Ported from BACH system/tools/encoding_fix.py

ellmos-ai/skills/tree/main/skills/utilities/encoding-fix/en commit fceb2b298e

Frequently asked questions

npx skillmds@latest add ellmos-ai/encoding-fix-2