Mojibake Fixer (Fix Garbled Japanese Text)

Paste garbled text such as “縺薙s縺ォ縺。縺ッ” or “ã“ã‚“ã«ã¡ã¯” and the tool finds which encoding was misread and restores the original Japanese.

Try an example:

What is mojibake?

Text is stored and sent as bytes using a character encoding. When a program reads those bytes with a different encoding than the one used to write them, you get garbled characters called mojibake. Japanese text has long been written in three encodings, UTF-8, Shift_JIS and EUC-JP, so each combination produces its own recognizable pattern. This tool tries every combination of “written as” and “read as” and shows the readable result.

Recognize the pattern

Real examples for the word 日本語 (“Japanese language”):

What you seeCauseRecoverable?
日本語UTF-8 read as Latin-1 (Windows-1252)Yes
“ú–{ŒêShift_JIS read as Latin-1Yes
ÆüËܸìEUC-JP read as Latin-1Yes
譌・譛ャ隱�UTF-8 read as Shift_JISMostly, except the “�” parts
縺薙s縺ォ縺。縺ッ (こんにちは)UTF-8 read as Shift_JISYes, if there is no “�”
���{��Shift_JIS read as UTF-8No
���ܸ�EUC-JP read as UTF-8No

Strings full of “ã”, “æ” or “Ô are UTF-8 read as Latin-1. Strings mixing kanji such as “縺”, “繧” with half-width katakana are UTF-8 read as Shift_JIS.

What can and cannot be restored

  • Restorable: text misread as Latin-1. No bytes were lost, so it comes back almost perfectly.
  • Partly restorable: UTF-8 misread as Shift_JIS. Bytes Shift_JIS cannot read were replaced by “�”, so those characters are gone.
  • Not restorable: Shift_JIS or EUC-JP misread as UTF-8. “�” replaced the original characters and the bytes no longer exist. Reopen the original file with the correct encoding instead.

When invisible characters (such as byte 0x81) were dropped while copying, the tool fills in part of the hiragana by guessing and marks the result as partly restored.

Common situations

SituationCauseFix
CSV looks garbled in ExcelExcel reads UTF-8 without a BOM as Shift_JISSave as UTF-8 with BOM, or import via Data → From Text/CSV and choose 65001: Unicode (UTF-8). The CSV ⇔ JSON converter can also save with a BOM
Web page is garbledThe file encoding, <meta charset> and the Content-Type header disagreeMake all three UTF-8
Database text is garbledTable and connection encodings differUse utf8mb4 everywhere in MySQL and set it on the connection
Email subject shows =?UTF-8?B?...?=MIME (Base64) encoded headerBase64-decode it as UTF-8
File names in a ZIP made on Windows are garbled on a MacWindows stores them in Shift_JIS (CP932)Choose Shift_JIS in the unarchiver

Not mojibake, just another notation

You seeIt isTool
&#12371;&#12435;HTML numeric character referencesHTML Unescape
\u3053\u3093Unicode escapesUnicode Unescape
%E3%81%93%E3%82%93Percent-encodingURL Decode
E3 81 93 E3 82 93Hexadecimal bytesHex Decoder

Frequently asked questions

What does “�” mean and can it be restored?

“�” (U+FFFD, the replacement character) marks a spot where the original information was already lost while reading, so that character cannot be restored. If the characters around it are intact, this tool can still restore the readable parts.

What is “鐃緒申”?

It is what you get when the replacement character “�” is written as UTF-8 and then read as EUC-JP. The original characters are already gone, so the text cannot be recovered from this string. Reopen the original data instead.

What does “縺薙s縺ォ縺。縺ッ” say?

It says “こんにちは” (hello). Reading UTF-8 as Shift_JIS turns each hiragana into a kanji plus a half-width katakana. Paste it above to restore it.

What does “ã“ã‚“ã«ã¡ã¯” say?

It is also “こんにちは”, UTF-8 read as Latin-1 (Windows-1252). “ã” is the byte (E3) that starts most hiragana in UTF-8.

How do I check a file’s encoding?

On Mac or Linux, run file --mime-encoding filename or nkf --guess filename. In VS Code the current encoding is shown at the bottom right, and you can click it to reopen the file with another encoding.

Can I fix a file I already saved while garbled?

Usually not. Once garbled text is saved again in another encoding, the original bytes have been overwritten. Look for a backup or the original file. This tool only converts text and never changes files.

Is my text sent anywhere?

No. Everything runs in your browser and disappears when you close the page.