🔧

Mojibake Repair

Repair text garbled by the wrong encoding, converting between UTF-8 and GBK and showing bytes
Mojibake 📂 Text 👤 ToolWorld 🏷️ v1.2.2
Loading...
Input Paste or type text; it is processed locally
Text
Settings Choose how to process
Mode

Everything runs in the browser; your text is never uploaded

Enter text and press process. Everything runs locally; nothing is uploaded

Result Copy the result in one click

How to Use

📖 Tool Introduction


Repair text that was garbled by being read with the wrong encoding, reproduce the garbling in reverse, or look at the raw bytes of a piece of text.

The cause is simpler than the symptom. A file stored as UTF-8 is opened as GBK, every byte is interpreted against the wrong table, and Chinese text comes out looking like a string of unrelated characters. Nothing has been corrupted. The bytes are exactly what they were, and only the interpretation is wrong, which is why the original can be recovered rather than merely guessed at. It is worth knowing this before spending time on anything else, because the instinct is to assume the file is damaged.

Repairing it works like this. The characters in the garbled string all sit in the range from zero to two hundred and fifty five, and each of those is one byte of the original UTF-8 sequence. Taking those bytes back and decoding them as UTF-8 restores the text. Decoding runs in strict mode first, so that a sequence which is not valid UTF-8 is reported rather than silently turned into replacement characters that look like a plausible but wrong answer.

The reproduce mode does the opposite: it encodes normal text to UTF-8 bytes and decodes them as GBK, producing the garbled form. That sounds useless and is not. If you suspect a particular piece of garbling came from exactly this mistake, running a known good string through this mode and comparing the output confirms or rules it out in one step, which is far faster than reasoning about it.

The byte mode simply prints the UTF-8 bytes in hex, which is how you tell what a piece of data actually is when the encoding is unknown and the file extension is no help. Everything runs in the browser, so what you paste never leaves your device.

Recognition helps, and it is worth a sentence on how to tell what you are looking at before reaching for a tool. Text that has been through this mistake tends to keep its length recognisable and to be made of characters that look unrelated to each other, while genuinely corrupt data usually shows replacement characters or breaks in the middle of a sequence. When the garbled text is long and the characters are individually valid, the bytes are almost certainly intact and the repair will work.

✨ Key Features


  • Recovers Chinese text that was read with the wrong encoding
  • Reproduces the garbling in reverse, to confirm the cause
  • Shows the UTF-8 bytes of a text in hex
  • Decodes strictly, and says so when the bytes are not valid
  • Reports the input and output sizes
  • Runs locally: nothing is uploaded

🚀 How to Use


  1. Paste the garbled text on the left
  2. Pick a mode on the right
  3. Press process, or use Ctrl plus Enter
  4. The result box shows the repaired text or the byte sequence
  5. Copy result puts it on your clipboard

⚠️ Things to Note


  • Data source: Uses the encoding conversion built into the browser; conversion runs there too
  • Only for single byte garbling: Repair needs every garbled character to be within zero to two hundred and fifty five, and says so otherwise
  • Not everything can be repaired: Text damaged by several wrong conversions, or bytes that are actually corrupt, cannot be recovered and is reported as such
  • GBK covers simplified Chinese: It includes the whole earlier standard; traditional Chinese garbling involving a different encoding is outside this tool
  • Privacy: Everything runs in the browser. What you paste is never sent to a server

Related

⏫︎