Hex 与文本互转
十六进制与 UTF-8 文本双向转换:0x 前缀与空格容错、非法字节用 U+FFFD 标注,逐位报错定位。
Direction
Hex format
Notes
Text is encoded as UTF-8 — non-ASCII characters (汉字, emoji) become multiple bytes, so “世” is E4 B8 96. Decoding accepts messy input freely: 0x prefixes, colons, commas, spaces, newlines and mixed case are all stripped automatically. If the byte count is odd or a character is not hex, the error names the exact position. Invalid UTF-8 sequences are replaced with U+FFFD and reported.
如何使用Hex 与文本互转
十六进制字节直接粘贴——带不带 0x 前缀、空格或逗号分隔都行——右侧立刻给出可读的 UTF-8 文本。反向同样成立:文本转 hex 用于构造字节流,hex 转文本用于检查报文、日志行或数据库字段里到底装着什么。
输出里出现替换字符(U+FFFD)说明这串字节不是合法 UTF-8——多半是旧编码页或者伪装成文本的二进制。这个视觉信号是最快的编码类型探针,先看清再动手转。