UTF-8 中的所有汉字字符都是 3 字节长吗?
有人可以确认所有中文汉字字符在 UTF-8 中都是 3 个字节长吗?
Can someone please confirm that all Kanji characters in Chinese are 3 bytes long in UTF-8?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,汉字是 U+4e00 到 U+9faf,UTF8 3 字节是 U+0800 到 U+FFFF。
Yes, Kanji is U+4e00 to U+9faf, UTF8 3 bytes are U+0800 to U+FFFF.
常用的汉字/汉字位于 U+4E00 和 U+9FFF 之间的“中日韩统一表意文字”块中,在 UTF-8 中占用 3 个字节。 (日文平假名和片假名字符也占用 3 个字节。)
但是,“CJK 统一表意文字扩展 B”和“CJK 兼容表意文字补充”块中也有一些很少使用的字符,在 UTF-8 中占用 4 个字节。
另请注意,中文文本通常包含 ASCII 字符,例如数字 0-9。
The commonly used Hanzi/Kanji characters are in the "CJK Unified Ideographs" block between U+4E00 and U+9FFF, and take 3 bytes in UTF-8. (The Japanese Hiragana and Katakana characters also take 3 bytes.)
However, there are also some very rarely-used characters in the "CJK Unified Ideographs Extension B" and "CJK Compatibility Ideographs Supplement" blocks, which take 4 bytes in UTF-8.
Also be aware that Chinese text often contains ASCII characters like the digits 0-9.