Unicode and Encoding Repair Tool

Repairs the classic "mojibake" pattern produced when UTF-8-encoded text gets decoded one byte at a time as Windows-1252 or Latin-1 (turning "café" into "café"), by mapping each character back to the single byte it represents under Latin-1 and re-decoding those bytes as UTF-8, after first checking the input actually looks like mojibake. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

Copy text out of a database, email, or old export and it sometimes comes out looking like "café" instead of "café", or "don’t" instead of "don't". That's mojibake: perfectly good UTF-8 text that got decoded one byte at a time as a different encoding somewhere along the way.

This tool reverses the single most common cause of that damage, so you get the original readable text back without having to track down and re-fix the system that mangled it.

What Is Unicode and Encoding Repair Tool?

A mojibake repair tool that detects and reverses the specific, extremely common failure mode where UTF-8-encoded text is decoded as Windows-1252 or Latin-1, corrupting every accented or non-ASCII character into a short sequence of Latin-1-looking characters.

It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.

How Unicode and Encoding Repair Tool Works

The tool first checks the input for the tell-tale mojibake signature: the character "Ã" (which is what the UTF-8 lead byte for any Latin-1 Supplement letter looks like when misread one byte at a time) immediately followed by a character in the Unicode range that a UTF-8 continuation byte produces under the same misreading. If that pattern isn't present, it reports that no mojibake was detected rather than risk mangling clean text.

When the pattern is found, each character in the input is mapped back to the single byte value (0-255) it represents under Latin-1, since that one-to-one character-to-byte mapping is exactly what produced the mojibake in the first place. Those recovered bytes are then decoded as UTF-8 using a strict decoder, which reconstructs the original text.

When To Use Unicode and Encoding Repair Tool

Use it whenever pasted or exported text shows garbled sequences like "é", "è", or "’" where accented letters or smart quotes should be.

It's a fast way to get the answer without opening a hex editor, a REPL, or writing a one-off script just to check.

Features

Advantages

  • Detects the mojibake pattern before attempting a fix, so it doesn't silently corrupt text that's already correct.
  • Uses a strict UTF-8 decode for the final step, so it fails loudly instead of producing a second layer of garbled output if the recovered bytes aren't actually valid UTF-8.
  • Handles the by-far-most-common real-world mojibake case (UTF-8 misread as Windows-1252/Latin-1) that affects the vast majority of Western European text mishaps.

Limitations

  • Only reverses a single round of UTF-8-as-Latin-1 mojibake; text that's been double-encoded, or that was originally in a non-Latin-1 legacy encoding, won't be fixed correctly.
  • The detection heuristic looks specifically for the "Ã" marker pattern, so unusual or partial mojibake that doesn't happen to include that exact signature won't be recognized, even if the text is genuinely garbled.
  • Text containing any character above code point U+00FF (for example, a genuine emoji or CJK character alongside the mojibake) can't be repaired, since those characters can't be mapped back to a single Latin-1 byte.

Examples

Repairing a garbled café

Input

café and résumé

Output

café and résumé

Each "Ã" + high-byte-character pair is the UTF-8 encoding of an accented letter misread as Latin-1; recovering the original bytes and re-decoding as UTF-8 restores the accents.

Best Practices & Notes

Best Practices

  • Fix the root cause (the system or import step decoding UTF-8 as Latin-1) in addition to using this tool as a one-off cleanup, so the mojibake doesn't keep recurring.
  • Run the CSV Encoding Detector on the original file first if you have access to it, to confirm it really was UTF-8 before assuming this specific repair applies.
  • Spot-check the repaired output for a few known words, since a text that happens to trigger the detection heuristic without actually being mojibake would produce nonsense output.

Developer Notes

Detection uses the regex `/Ã[\x80-¿]/` (character class U+0080-U+00BF), matching the UTF-8 lead byte for any Latin-1 Supplement character read as Windows-1252/Latin-1, followed by a continuation byte read the same way. Repair maps each character's code point directly to a byte via `charCodeAt`, throwing a clear error for any code point above 255, then decodes with `new TextDecoder("utf-8", { fatal: true })` so a failed re-decode surfaces as an explicit error instead of silently producing more garbage.

Unicode and Encoding Repair Tool Use Cases

  • Cleaning up product names or customer data that were imported through a system that assumed the wrong encoding
  • Fixing garbled text pasted from an old email client or legacy database export
  • Recovering readable text from a CSV or JSON export where accented characters turned into multi-character sequences

Common Mistakes

  • Running this tool on text that isn't actually mojibake; the built-in detection guard should catch this, but always sanity-check the reported result.
  • Expecting it to fix encoding problems that aren't UTF-8-decoded-as-Latin-1, such as text that's been through two different wrong decodings in sequence.

Tips

  • If the tool reports no mojibake pattern found but the text still looks wrong, the underlying issue may be a different encoding mismatch (for example, UTF-16 mistaken for single-byte text) rather than the specific pattern this tool targets.
  • Combine this with the BOM Detector and Remover if the source file also had a leftover byte order mark before this text was extracted.

References

Frequently Asked Questions