Encoding Fix

Mojibake-Reparatur für doppelt/dreifach kodiertes UTF-8. Behebt Windows-cp1252/Latin-1-Fehlinterpretationen. Ohne Abhängigkeiten.

ellmos-ai 9a3c501 9 files · 162.7 KB Updated

File contents

Encoding Fix

Repariert Mojibake (doppelt/dreifach kodiertes UTF-8) das durch Windows cp1252/Latin-1 Fehlinterpretation entsteht. Zero Dependencies — nur Python stdlib.

Typisches Problem

"ue" (U+00FC) → UTF-8 \xc3\xbc → als cp1252 gelesen → "ü"

Nutzung

Als Library

from encoding_fix import sanitize_outbound

clean = sanitize_outbound("Würge")  # → "Würge"

Subprocess-Output

from encoding_fix import sanitize_subprocess_output

text = sanitize_subprocess_output(process.stdout)

CLI

python encoding_fix.py "Würge"    # Einzelnen String prüfen
python encoding_fix.py              # Selbst-Test

Features

  • Idempotent: Korrekt kodierter Text wird nicht veraendert
  • Bis zu 3 Runden: Repariert auch dreifach-kodierte Strings
  • Subprocess-Dekoder: UTF-8/cp1252 Fallback fuer Prozess-Output
  • Zero Dependencies: Nur Python stdlib

Changelog

1.0.0 (2026-03-12)

  • Portiert aus BACH system/tools/encoding_fix.py

ellmos-ai/skills/tree/main/skills/utilities/encoding-fix commit 9a3c5013d2

Frequently asked questions

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