编码 Unicode text into an ASCII-safe representation
转换 text containing non-ASCII characters (emoji, CJK, accents) into pure-ASCII forms like \uXXXX escapes or HTML entities so it survives ASCII-only channels.
- 1
遗留 systems, 源-代码 comments, 和一些 APIs 拒绝 non-ASCII bytes. Unicode escape sequences (\u00e9 为 é) 和 HTML entities (é) 是 two ASCII-仅 encodings 该 preserve exact 字符和 是 reversible.
- 2 Unicode 转换器 →
Paste 文本具有 accents 或 emoji. tool 输出 \uXXXX escape sequences 该任何 JSON parser 或 JS engine reads 回 identically.
- 3 HTML 实体编码器 →
为 HTML contexts, 编码相同文本 as numeric entities (é) 所以它 renders 正确在 任何 ASCII-仅 HTML file.
- 4
Choose escape 风格 based 开目标: \uXXXX 为 JSON/JS 源, \xXX 为单个-字节 strings, &#xNNNN; 为 HTML, 和 U+NNNN 为文档.
常见问题
- 为什么一些 characters 成为 two \u escapes?
- Characters 外部基础 Multilingual Plane (emoji, 罕见 CJK) 是 encoded as surrogate pairs — two \uXXXX sequences 该 together 表示 one 代码 point. 此是 标准 JSON 行为.
- 是 HTML entities 和 Unicode escapes interchangeable?
- 它们编码相同 characters 但为 不同 parsers. HTML entities 工作在 HTML/XML; \u escapes 工作在 JSON/JS. Using 错误 one means 字面量文本 shows 上 unrendered.