F

Unicode 中文互转Unicode Converter

Unicode编码与中文字符互相转换Convert between Unicode escapes and Chinese characters.

关于 Unicode 中文互转About Unicode Converter

在 Java properties 文件、JavaScript 字符串或某些老旧系统中,中文常被写成 \uXXXX 形式的转义序列。本工具支持 Unicode 转义与中文(及其他字符)双向互转,解决配置乱码与代码可读性问题。In Java properties files, JavaScript strings and some legacy systems, Chinese is often written as \uXXXX escape sequences. This tool converts between Unicode escapes and Chinese (or any other characters) in both directions, fixing config mojibake and readability problems.

使用方法How to Use

  1. 粘贴含 \uXXXX 转义的文本,点击「Unicode 转中文」得到可读原文。Paste text containing \uXXXX escapes and click "Unicode to text" to get the readable original.
  2. 或输入中文,点击「中文转 Unicode」得到转义形式。Or type Chinese and click "Text to Unicode" to get the escaped form.
  3. 工具自动识别四位十六进制转义,并正确处理 Emoji 等代理对字符。The tool recognises four-hex-digit escapes automatically and handles surrogate-pair characters such as Emoji correctly.

常见问题FAQ

Unicode 转义主要用在哪些场景?Where are Unicode escapes mainly used?

Java properties 文件(默认 ISO-8859-1 读取)、部分 JS 代码生成场景、以及不支持 UTF-8 的老旧系统,用转义可以避免编码不一致导致的乱码。Java properties files (read as ISO-8859-1 by default), some JS code-generation scenarios, and legacy systems without UTF-8 support — escapes avoid mojibake from encoding mismatches.

为什么 Emoji 转出来是两个 \u?Why does an Emoji become two \u sequences?

Emoji 等超出基本多文种平面的字符使用 UTF-16 代理对表示,因此会生成一对 \u 转义,这是标准行为,工具会自动成对处理。Characters beyond the Basic Multilingual Plane, like Emoji, use UTF-16 surrogate pairs, so they produce a pair of \u escapes. This is standard behaviour and the tool handles pairs automatically.

转换结果不对怎么排查?How do I troubleshoot wrong results?

检查转义是否为完整的四位十六进制(\u4f60 而非 \u4f6),以及反斜杠是否被二次转义写成了 \\u。Check that escapes are complete four-hex-digit sequences (\u4f60, not \u4f6) and that backslashes have not been double-escaped into \\u.

相关阅读Related Reading

相关工具Related Tools