代理对

Encoding & Standards

用于表示U+FFFF以上字符的两个UTF-16编码单元组合,由高代理(U+D800-U+DBFF)和低代理(U+DC00-U+DFFF)构成。

Characters with code points above U+FFFF cannot fit in a single 16-bit value. UTF-16 solves this by encoding them as two 16-bit values called a surrogate pair. Since most emoji are above U+FFFF, surrogate pairs are extremely common with emoji.

For example, 😀 (U+1F600) becomes the surrogate pair 0xD83D 0xDE00 in UTF-16. The formula: high surrogate = 0xD800 + ((cp - 0x10000) >> 10), low surrogate = 0xDC00 + ((cp - 0x10000) & 0x3FF).

This is why JavaScript's `'😀'.charCodeAt(0)` returns 55357 (0xD83D) — it's returning the high surrogate, not the actual code point.

相关术语

UTF-16 UTF-16
每字符使用2或4个字节的可变长度Unicode编码方式,被JavaScript、Java和Windows内部使用。
平面 平面
由65,536个连续Unicode码位构成的分组。第0平面为基本多文种平面(BMP),大多数表情符号位于第1平面(SMP)。
编码单元 编码单元
用于编码字符的最小位组合:UTF-8为8位,UTF-16为16位,UTF-32为32位。
补充多文种平面(SMP) (SMP) 补充多文种平面(SMP) (SMP)
Unicode第1平面(U+10000至U+1FFFF),绝大多数表情符号码位都分配在此区域。

相关工具

🔢 Unicode 查询 Unicode 查询
输入 U+1F600 等码位,获取表情符号、编码详情、UTF-8/16 字节和 HTML 实体。
🔍 序列分析器 序列分析器
将 ZWJ 序列、肤色修饰符、键帽序列和旗帜对解析为独立组成部分。