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 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

Also as a pay-per-call API

$0.004 per call. No model runs: the answer is deterministic.

POST https://api.aiskills402.com/v1/run/mojibake-repair

One payment buys one call on one input. If the input cannot be handled, the answer is a refusal that starts with "CANNOT …" and says why; that refusal is a result, and it is paid like any other.

Free example and input schema. The SKILL.md file is still sold separately, once, for people who want the rules themselves. The protocol is in the docs.

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.

Read more

Share

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

  • JSON Repair: Fix Broken JSON, 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 Broken CSV, 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

More in Data & Analysis

  • Config Format Convert: JSON, YAML, TOML, INI, .env

    Data & Analysis

    SKILL.md · v1.0.0 · 11.0 KB

    Converts a config file between JSON, YAML 1.2, TOML 1.0, INI and .env with every key, value and type kept, and answers with the converted document only, no code fence. Strings that look like other things are quoted so they stay strings (the text 1.10, 007, 01234, no, null, an empty string, a date in quotes), a YAML 1.10 stays the number 1.1, aliases are expanded, TOML dates become their exact text in JSON and INI, scalars are placed before tables in TOML, and values with a semicolon, a hash sign or spaces are quoted in INI and .env. Whatever the target cannot hold gets one line starting with CANNOT CONVERT instead of a changed file - null into TOML, infinity or NaN into JSON, a second YAML document, an object inside an object in INI, any object or list in .env, a key given twice. Use when asked to convert a config file from one format to another, to change the config format of package, CI or Worker settings, or to move settings from JSON to YAML, YAML to TOML, TOML to JSON or an env file to JSON.

    $0.01once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 9 Oct 2026

  • Subtitle Timing Repair: Fix SRT and VTT, Words Stay

    Data & Analysis

    SKILL.md · v1.0.0 · 10.8 KB

    Repairs the structure of an SRT or WebVTT subtitle file so a video player reads it, without changing a single word and without changing the value of a single time, and answers with the file only, no code fence. Fixes the separator before the milliseconds (a comma in SRT, a dot in VTT), broken arrows, short hours and short millisecond fields, missing or doubled blank lines between cues, cue numbers that skip, repeat or are out of order after cues were deleted (renumbered in file order, cues never reordered), cues with no number, a missing WEBVTT header or the blank line after it, a byte order mark and mixed line endings. Tells a cue number from a text line that only looks like one (a year, a count), keeps a text line that contains an arrow, keeps VTT cue settings, identifiers and NOTE blocks, and leaves overlapping cues exactly as they are, since overlap is legal. A cue that ends before or at its own start, a cue with no timing line, seconds above 59 and a garbled timestamp get a fixed one-line CANNOT REPAIR answer, because only a person knows which time is right. Use when a subtitle file will not load, shows as one block or is rejected by a player or an upload form, or when asked to fix, clean up or validate SRT or VTT structure.

    $0.02once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • SQLite Query From a Question for D1

    Data & Analysis

    SKILL.md · v1.0.0 · 12.3 KB

    Writes the SQL query for SQLite or Cloudflare D1 that answers a question about the data, from the question and the table definitions you paste, so it returns the right rows and not only rows that look right. Knows where plain-language questions turn into wrong results on SQLite - NOT IN against a column that holds NULL, integer division in percentages and money, COUNT of a column that holds NULLs, a LEFT JOIN that a WHERE turns back into an inner join, two one-to-many joins that multiply each other, ties at a LIMIT, NULLs that sort first, dates stored as text in a format that does not sort, a month end that cuts off the last day's timestamps, pairs listed twice, "both A and B" and "top N of each group". Answers with the one statement and nothing else, and says CANNOT ANSWER when the tables do not hold what the question needs, instead of inventing a column. Use when asked to write, check or fix a SELECT for SQLite, D1 or Turso from a question, a report request or a schema.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Fixed-Width to CSV: Cut by Spec, Trim Only When Told

    Data & Analysis

    SKILL.md · v1.0.0 · 8.7 KB

    Converts fixed-width text (mainframe exports, bank and statistics files, printed reports) into RFC 4180 CSV from a column specification and answers with the CSV only, no code fence. Positions are 1-based and inclusive unless the spec says otherwise, and count characters, so accented and Cyrillic letters do not shift later columns. Every cell is the exact characters of its positions: nothing is trimmed unless the spec says trim, leading zeros and inner spaces stay, numbers stay text, and an implied decimal becomes a point only where the spec states it. A value with a comma or a quote is quoted. A line that does not fit the spec, overlapping columns, a tab, a byte-based spec meeting non-ASCII text, or a signed overpunch digit gets a fixed one-line CANNOT CONVERT answer instead of a guessed table. Use when a fixed-width file has to become CSV for a spreadsheet, a database or a data pipeline.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026