Garbled Text Diagnoser - Encoding Detection & Fix
Paste mojibake and get the likely original encoding (UTF-8/GBK/Latin-1/Shift-JIS) with a concrete fix and evidence characters, locally.
This tool runs in your browser: what you enter is processed on your device and normally never appears in a request to any server.
Usage Guide
Mojibake like “䏿–‡” is text decoded with the wrong charset at one hop. Humans can’t read the cause, but garbled text carries a “signature”: specific character patterns reveal whether UTF-8 was read as Latin-1, GBK was read as UTF-8, or the text was double-encoded. This tool matches your pasted sample against 8 common signatures and outputs the most likely cause, a confidence level, and a repair preview — most cases recover directly in the browser. Fully local.
1. How to diagnose
All analysis runs in the browser; nothing is uploaded, so logs and chat excerpts are safe to paste.
- Paste the garbled text as-is — avoid middlemen that “helpfully” re-encode (some chat and notes apps repair silently).
- Diagnose. The tool matches its signature library and reports the top cause, confidence, and a repair preview.
- If the preview reads correctly, copy it out. If not, check the second candidate — chained mis-encoding is common.
2. Why text garbles
Text is bytes; an encoding maps bytes to characters. When writer and reader disagree, you get mojibake: bytes produced as UTF-8 but read as GBK become rare-looking Han characters. The saving grace: as long as no lossy step intervened, the bytes survive intact inside the garbled display, so most cases reverse exactly — if you can name the disease.
3. The eight signatures
The recognizer covers: UTF-8 read as Latin-1/CP1252 (the “䏿–‡” look — accented Latin plus punctuation soup); UTF-8 read as GBK (rare-Han look); GBK read as UTF-8 (immediate replacement characters — lossy, not fully recoverable); Latin-1 vs. CP1252 drift (euro sign and quote positions); double UTF-8 encoding; leftover HTML entities; Base64 mistaken for text; and invisible-character pollution (looks fine but never compares equal). Each signature maps to a repair path with a live preview.
4. Repair paths at a glance
- “䏿–‡”: re-encode the displayed characters back to Latin-1 bytes and decode as UTF-8.
- Rare-Han look: the same round-trip through GBK bytes.
- Replacement characters present: the decoder already dropped illegal bytes — re-export from the source; no tool can rebuild lost bytes.
- Double encoding: apply the inverse twice; the tool suggests the iteration count.
5. Prevention beats repair
- Declare charset=utf8mb4 explicitly on DB connections; never rely on defaults.
- Emit a BOM with CSV exports so Excel doesn’t guess GBK.
- Keep the logging pipeline (filebeat/fluentd) uniformly UTF-8 — one wrong hop corrupts everything downstream.
- Send a “中文测试” canary through a new pipeline before trusting it; cheaper than repairing a warehouse of data.
6. Boundaries
Diagnosis is signature matching: very short samples lose confidence, and the tool says so. Samples already containing replacement characters can be diagnosed but not restored — that is information-theoretically irreversible, not a tool limitation. Privacy: entirely local computation, zero network calls.
FAQ
Eight common signatures: UTF-8 read as Latin-1/CP1252 (the 䏿–‡ pattern), UTF-8 read as GBK (the 娴嬭瘯 pattern), GBK read as UTF-8 (instant replacement characters), Latin-1 vs CP1252 drift, double UTF-8 encoding, leftover HTML entities, Base64 mistaken for text, and zero-width or invisible-character pollution. Each signature maps to a repair path, previewed live by the tool.
Not fully. A replacement character means the decoder already discarded the offending bytes — information-theoretically irreversible. The tool says so plainly; the only recourse is re-exporting from the source.
Paste it exactly as it is, and skip middlemen that auto-transcode — WeChat and note-taking apps sometimes "helpfully" repair the garbled text first, which destroys the signature the diagnosis relies on.
Yes. Diagnosis is signature-based, so below roughly the information content of 4-6 Chinese characters the confidence drops noticeably, and the tool labels that honestly.
Turn to the second candidate cause. Chained mis-encoding is common — double encoding, for example, takes two reverse passes — and following the candidates round by round recovers it.
Yes — everything is computed locally with zero network requests; the text never leaves your browser.
Related Tools
Related Articles
Base64 Decode Shows Garbled Text or Black Question Marks for Chinese — How to Fix
Base64 decode turns Chinese into mojibake or black question marks? Explains the root cause — Base64 encodes bytes, not characters — and gives command-line, code, and online-tool fixes, all processed locally.
How to Fix 'Hydration failed / Text content does not match' in Next.js
The complete guide to Next.js/React SSR hydration errors: why server and client renders diverge, the three usual suspects (timestamps, random values, localStorage), correct suppressHydrationWarning usage, and a ClientOnly pattern for browser-only widgets.
How to Batch Encode Multiple Files or Texts to Base64 (No Script Needed)
Need to convert dozens of images or strings to Base64 at once? Learn batch Base64 encoding and step-by-step how to do it locally without uploading files or writing scripts.