Mojibake Decoder (fix garbled Japanese text such as 縺薙s, ã“ã‚“ or ‚±‚ñ and detect the encodings automatically)

Completely free, with no extra charges. You may freely use the output commercially.

About this tool

Paste garbled text such as “縺薙s縺ォ縺。縺ッ”, “ã“ã‚“ã«ã¡ã¯” or “‚±‚ñ‚É‚¿‚Í”, and the tool tries every combination of the encoding the text was saved in and the encoding it was wrongly read with, then lists the restored candidates in order of how naturally they read. This kind of garbling is called mojibake in Japanese. The tool is built mainly for Japanese text and also restores Chinese and Korean text. It covers UTF-8, Shift_JIS (CP932, the legacy encoding of Japanese Windows), EUC-JP, Windows-1252, GBK and more, as well as mojibake that happened twice in a row.

Email subjects such as =?ISO-2022-JP?B?…?=, bodies like =E3=81=93, URLs like %E3%81%93, Python bytes like b'\xe3\x81\x93', \u3053, こ and JIS code whose escape characters were stripped ($B$3$s$K(B) can be pasted into the same box and turned back into readable text. It helps when you no longer have the original file and only the garbled text on a screen, in an email or in a log remains. All processing happens entirely in your browser (no data is sent).

Restore garbled text

    Characters with a dotted underline were guessed by filling in lost bytes. 〓 marks a character with too many possibilities to decide; hover over it or focus it to see the candidates.

    Decode with chosen encodings

    If none of the automatic candidates is right, or you already know the combination, choose the encoding the text was saved in and the one it was displayed with. The text in the box above is converted.

    Make mojibake samples

    Enter normal text to see how it gets garbled by each combination. Compare the list with the mojibake you have to find out which combination caused it.

    Saved asDisplayed asHow it looks

    How to use

    1. Copy the garbled part and paste it into “Garbled text”. Normal text or ASCII before and after it is fine.
    2. Restoration candidates appear in order of readability. Each shows the combination, such as “Text saved in UTF-8 was displayed as Shift_JIS”, and where that usually happens.
    3. Press “Copy” on the candidate that reads correctly. Dotted characters and 〓 include guesses, so check them against the context.
    4. If no candidate is right, pick a combination in “Decode with chosen encodings”, or compare patterns in “Make mojibake samples”.

    Telling common mojibake apart

    The same Japanese phrase “文字化けテスト” (“mojibake test”) always looks the same for a given pair of saved and displayed encodings. The first few characters are distinctive, so they help you tell the combinations apart.

    CombinationHow it looksWhere it happens
    UTF-8 → Shift_JIS譁�ュ怜喧縺代ユ繧ケ繝�
    縺薙s縺ォ縺。縺ッ
    A UTF-8 CSV opened in Excel on Japanese Windows, or UTF-8 shown by old software or the Command Prompt on a Japanese system. Lots of “縺”, “繧” and “繝”
    UTF-8 → Windows-1252文字化ã‘テスト
    ã“ã‚“ã«ã¡ã¯
    A database connection left at latin1, or a mail client, CMS or software set to a Western encoding. Lots of “ã” and “—
    Shift_JIS → Windows-1252•¶Žš‰»‚¯ƒeƒXƒg
    ‚±‚ñ‚É‚¿‚Í
    Shift_JIS text opened in English-language software or a non-Japanese service. Lots of “‚” and “ƒ”
    UTF-8 → GBK鏂囧瓧鍖栥亼銉嗐偣銉�
    銇撱倱銇仭銇�
    UTF-8 Japanese shown on Simplified Chinese Windows or by a service in mainland China. Lots of “銇”, “銈” and “銉”
    Shift_JIS → GBK暥帤壔偗僥僗僩
    偙傫偵偪偼
    A Shift_JIS file opened on a Chinese system
    EUC-JP → Shift_JISハクサ嵂ス、ア・ニ・ケ・ネ
    、ウ、ヒ、チ、マ
    EUC-JP from an old Unix-based system or email opened on Japanese Windows. Lots of half-width “、”
    Shift_JIS → UTF-8���������e�X�gA Shift_JIS CSV or text file opened as UTF-8. Characters replaced by “�” cannot be restored

    Mojibake that cannot be restored

    “�” (U+FFFD, the replacement character) marks bytes that the software reading the text could not interpret. The original bytes were discarded at that point, so a string full of “�” cannot be turned back into the original characters by calculation. That is what happens when a Shift_JIS file is opened as UTF-8. If you still have the original file, use the Character Encoding Converter to specify the correct encoding and convert it to UTF-8 again.

    “锟斤拷” and “鐃緒申” belong to the same family. They are what you see when characters that already became “�” are saved as UTF-8 and shown as GBK (“锟斤拷”) or EUC-JP (“鐃緒申”); the original characters are already gone.

    With UTF-8 → Shift_JIS mojibake, byte sequences that do not exist in Shift_JIS become “�”, so one or two bytes are lost. The tool tries the values those missing bytes could have had and looks for ones that form valid characters. When only one candidate fits, or one candidate is far more frequent (such as “。” or “の”), it fills in the guess (dotted underline); otherwise it shows 〓.

    Notes

    • With short text or text that is mostly ASCII, several combinations can look about equally plausible. Compare each candidate’s explanation and typical situation.
    • The scoring is tuned for Japanese, Chinese and Korean. Accented Latin letters garbled on their own (for example “für” for “für”) may not produce a candidate; in that case choose UTF-8 and Windows-1252 under “Decode with chosen encodings”.
    • For real examples of how often guessed characters turn out right and where restoration stops being possible, see “Fixing Japanese Mojibake: Reading the Cause From How It Looks, and What Can and Cannot Be Restored”.
    • In Windows-1252 mojibake, the bytes 0x81, 0x8D, 0x8F, 0x90 and 0x9D become invisible control characters and can disappear when copied. The tool fills them in from the surrounding bytes, but that is a guess.
    • The conversion tables follow the browser implementation (WHATWG Encoding Standard). Shift_JIS matches Windows CP932, including NEC special characters and IBM extensions.
    • To change the encoding of a whole file, use the Character Encoding Converter. To find invisible characters such as zero-width spaces, use the Invisible Character Checker, and to create URL encoding, use URL Encoder / Decoder. For how to handle a folder of files in mixed encodings, see “How to Safely Rescue Mixed-Charset Files in Bulk”.