Restore text from common double-encoding mojibake and report its character composition.
C4 E3 BA C3 或 C4E3BAC3)时,用浏览器原生 TextDecoder 分别按 UTF-8 / GB18030 / Big5 / UTF-16LE / UTF-16BE 严格解码(fatal 模式),只有不出现非法序列的编码才列入候选,再按可读性打分排序,并识别 UTF-8 / UTF-16 BOM。② 粘贴已解码的文本时,只做可验证的双重编码还原(UTF-8 字节被当作 Latin-1/Windows-1252 显示)。单凭字节无法区分 GBK 与 GB18030(GBK 是 GB18030 的子集,浏览器 gbk 标签即按 GB18030 解码),故候选统一标注 GB18030;GB18030 与 Big5 的字节区间大面积重叠,短文本只能给概率结论。若原文已含 U+FFFD 替换符,说明解码时信息已丢失,任何工具都无法还原,只能回到原始字节重新解码。| Item | Formula / Note | Source / Standard |
|---|---|---|
| Double encoding | UTF-8 bytes read as Windows-1252 can be mapped back to the original bytes | WHATWG Encoding Standard (windows-1252 index) |
| Strict UTF-8 decode | lead byte determines length; continuation bytes must be 0x80–0xBF; illegal sequences fail | RFC 3629 / TextDecoder fatal mode |
| Replacement character | U+FFFD indicates decoding already failed; the original information cannot be recovered from the text | Unicode U+FFFD |