Data & Analysis

Mojibake Repair: Undo Broken Encoding Exactly

Repairs mojibake, text whose accents, Cyrillic letters, quotes, dashes or emoji turned into strings such as è, ü, “, пр or Р—Рґ because UTF-8 was read as Windows-1252, Latin-1 or Windows-1251, once or twice. Gives back the original text exactly, character for character, by undoing the wrong reading byte by byte, and leaves text that is already correct untouched. When the damage is mixed with good text, mixes two encodings, or lost bytes, so that more than one original is possible, it answers with a fixed CANNOT REPAIR line instead of guessing. Use when text from a file, database, email, web page or export shows garbled characters, or when asked to fix, undo or decode broken encoding, double encoding or strange characters.

Mojibake Repair: Undo Broken Encoding Exactly is a tested SKILL.md that repairs mojibake, text whose accents, Cyrillic letters, quotes, dashes or emoji turned into strings such as è, ü, “, пр or Р—Рґ because UTF-8 was read as Windows-1252, Latin-1 or Windows-1251, once or twice; an agent buys it once for $0.01 over x402.

Tested 2026-10-09No code, no hidden instructionsv1.0.0 · 12.2 KB · perpetual license

Not for

Spelling or grammar correction, translation, restoring letters replaced by question marks, or text only partly damaged. Correct text comes back unchanged; text with more than one possible original gets a CANNOT REPAIR line instead of a guess. Windows-1251 Cyrillic saved byte per letter is restored only when the task names that code page.

Tested, honestly

Tested 2026-10-09 with a strong and a weak model.

With and without the skill

Results with and without the skill, for Sonnet and Haiku
SonnetHaiku
withwithoutwithwithout
Texts restored exactly (15 with one possible original)15/1515/1514/1515/15
Ambiguous texts refused, not guessed (6)6/61/66/61/6

Same request on both sides; it asks for the original text and for one sentence instead of a guess when the text cannot be restored with certainty. Sonnet without the skill restored every text with one possible original. On five of the six ambiguous ones it restored the text anyway, and each guess matched the original we started from; the skill refuses there by design, because another original is possible. Counted as a gain only in the second row, so the price rests on the first. Haiku behaved the same way without the skill, and with it slipped once on a named Windows-1251 origin.

Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.

SonnetStrong model, claude-sonnet-5-5
Right on all 21, checked by code character by character: Windows-1252 and Latin-1 damage in German and French, Cyrillic read as Windows-1252 and as Windows-1251, a Windows-1251 origin when the task names it, emoji, a CSV cell, a JSON line, double damage, a planted instruction, five texts that were already correct left untouched, and a CANNOT REPAIR line on six ambiguous inputs (mixed lines, two encodings, a replacement character, question marks, a lost invisible byte, a Windows-1251 origin the task does not name).
HaikuWeak model, claude-haiku-5-5
Right on 20 of 21, checked by code character by character, but when the task said the text was written in Windows-1251 it returned the damaged text unchanged.

Full test summary

Example

Our own test text, before and after the skill ran. Excerpts only.

German · claude-sonnet-5-5

Before

Größe: Müller & Söhne GmbH, Straße 12 — Öffnungszeiten: Mo–Fr 9–18 Uhr, Äpfel für 3,50 €

After

Größe: Müller & Söhne GmbH, Straße 12 — Öffnungszeiten: Mo–Fr 9–18 Uhr, Äpfel für 3,50 €

French · claude-sonnet-5-5

Before

Café crème à la française : « Où ça ? » dit-elle, déjà prête.

After

Café crème à la française : « Où ça ? » dit-elle, déjà prête.

Bulgarian · claude-sonnet-5-5

Before

привет, мир! Цена: 1 250 лв. Добро пожаловать в Пловдив.

After

привет, мир! Цена: 1 250 лв. Добро пожаловать в Пловдив.

English · claude-sonnet-5-5

Before

sku,note,qty A-1,‘Quote’ café,3 B-2,plain,4

After

sku,note,qty A-1,‘Quote’ café,3 B-2,plain,4

Portuguese · claude-sonnet-5-5

Before

São Paulo – naïve café

After

São Paulo – naïve café

What is in the file

  • Hard rules
  • How the damage works
  • What stays untouched
  • Already correct text
  • Work in this order
  • Short examples

Languages

Any language. Tried in: German, French, Bulgarian, English, Portuguese.

License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Full terms.

Versions

Current version 1.0.0, updated 2026-10-09. Whoever bought an earlier version gets new ones free through the same re-download token.

  1. v1.0.0 · 2026-10-09

    First release: undoes UTF-8 read as Windows-1252, Latin-1 or Windows-1251, once or twice, byte for byte; returns correct text unchanged; refuses mixed, lossy or ambiguous text with a fixed `CANNOT REPAIR:` line. Price set provisionally at $0.05 until the model test.

FAQ

How does it treat text that is only partly garbled?

It answers with a CANNOT REPAIR line. If one line is damaged and the next is already correct, nobody can tell afterwards which parts were changed, so the skill refuses instead of repairing some lines and leaving the rest as they were. The same line is the answer for two encodings mixed in one text. This all-or-nothing rule is deliberate: a repaired export that quietly mixes fixed and untouched rows is harder to audit than one that stops with a reason you can read. Reviewers get a clear reason.

Can it restore letters that turned into question marks or replacement characters?

No. Once the bytes were replaced, the original is gone and several letters would fit each place, so the answer is a CANNOT REPAIR line that a program can detect with a simple prefix test. A Cyrillic capital that lost its invisible half is refused for the same reason: the lead character alone could be any of sixteen letters. Typical sources are exports saved through an ASCII-only step, copy and paste that strips control characters, and databases that substituted a placeholder for anything they could not store.

Which damage does it undo, and what does it leave alone?

UTF-8 read as Windows-1252 or Latin-1 (German, French, Spanish, Turkish, dashes, curly quotes, emoji), Cyrillic read as Windows-1252 or Windows-1251, and the same damage applied twice. Text that is already correct, such as real accents, Cyrillic, or look-alikes like SÃO PAULO and 25°, comes back exactly as it came, with no note and no code fence. The answer is the restored text alone, so it can be written straight back to a file or a database field. Damage that was applied three or more times is reversed layer by layer until ordinary text appears.

Does it help Claude Sonnet?

Not where the text can be restored, hence one cent. Sonnet and Haiku each repaired twenty-one texts, file present and file absent, and our script held every output against its original letter by letter. On the fifteen with one possible original, plain Sonnet was already exact. On six ambiguous ones the file makes it answer CANNOT REPAIR; plain Sonnet restored five of them anyway, and every guess matched. The file trades such guesses for a refusal a program can detect. Invisible control bytes could not be tested: our command line strips them.

Share

Read this page as Markdown: /skills/mojibake-repair.md.

  • JSON Repair: Fix It, Keep Every Value

    Data & Analysis

    SKILL.md · v1.0.1 · 6.9 KB

    Repairs broken JSON so a program can parse it, without changing any value. Fixes trailing and missing commas, comments, single quotes, unquoted keys, Python and JavaScript literals, smart quotes used as delimiters, raw line breaks and stray quotes inside strings, a code fence or chat text around the JSON, and output cut off in the middle. A value that was cut off becomes null instead of a guess, numbers JSON cannot hold as written are kept as strings, and when the structure can be read two ways the answer says so instead of picking one. Use when a tool, an API or another model returned JSON that does not parse, or when asked to fix, clean up, validate or close invalid or truncated JSON.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 7 Oct 2026

  • CSV Repair: Fix the Form, Keep Every Cell

    Data & Analysis

    SKILL.md · v1.0.0 · 8.3 KB

    Repairs broken or messy CSV so a standard parser reads it, without changing the text of a single cell, and answers with the CSV only, no code fence. Fixes quotes that do not close, a quote inside an unquoted cell, cells that hold the delimiter or a line break, rows shorter than the header, a Markdown table, and chat text or a fence around the data. Numbers such as 1,250, 007 and 1.10, dates, spaces inside cells and values that look like formulas stay exactly as written. Semicolon and tab files keep their delimiter. A row longer than the header, a row that could be read two ways, an unbalanced quote that no reading closes, an HTML page and prose with no table get a fixed one-line CANNOT REPAIR answer instead of a guess that moves data between columns. Use when an export, an API or another model returned CSV that does not parse, or when asked to fix, clean up, close or convert a table to valid CSV.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026