欢迎光临散文网 会员登陆 & 注册

go编码-unicode/utf8细节

2023-02-17 17:27 作者:脱缰小野马の  | 我要投稿

UTF-8带BOM和不带BOM

UTF-8(8-bit Unicode Transformation Format)不需要 BOM,尽管 Unicode 标准允许在 UTF-8 中使用 BOM。

所以不含 BOM 的 UTF-8 才是标准形式,在 UTF-8 文件中放置 BOM 主要是微软的习惯(顺便提一下:把带有 BOM 的小端序 UTF-16 称作「Unicode」而又不详细说明,这也是微软的习惯)。

BOM(byte order mark)是为 UTF-16 和 UTF-32 准备的,用于标记字节序(byte order mark)。微软在 UTF-8 中使用 BOM 是因为这样可以把 UTF-8 和 ASCII 等编码明确区分开,但这样的文件在 Windows 之外的操作系统里会带来问题。



Unicode通用多字节字符集

使命: 为字符(char)编号(code point)

The Universal Multiple-Octet Coded Character Set, more simply known as the UCS, is intended to provide a single coded character set for the encoding of the written forms of all the languages of the world and of a wide range of additional symbols that may be used in conjunction with such languages.



go编码-unicode/utf8细节的评论 (共 条)

分享到微博请遵守国家法律