# Encoding Fix

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

- Skill: `ellmos-ai/encoding-fix-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ellmos-ai/encoding-fix-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ellmos-ai/encoding-fix-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ellmos-ai (https://skillmd.com/u/ellmos-ai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/ellmos-ai/encoding-fix-2

---


<img src="banner.png" width="100%" alt="encoding-fix banner">

> **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
```python
from encoding_fix import sanitize_outbound

clean = sanitize_outbound("WÃ¼rge")  # -> "Wuerge"
```

### Subprocess Output
```python
from encoding_fix import sanitize_subprocess_output

text = sanitize_subprocess_output(process.stdout)
```

### CLI
```bash
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

