BOM(字节顺序标记)

BOM

Encoding & Standards

放置在文本文件开头的字符(U+FEFF),用于指示UTF-16/UTF-32编码中的字节顺序(字节序)。

The BOM is a special Unicode character used to signal the byte order of a text stream. In UTF-16, it distinguishes between little-endian (FF FE) and big-endian (FE FF) formats.

In UTF-8, a BOM (EF BB BF) is sometimes added but is not recommended — it can cause issues with scripts, JSON parsing, and Unix tools that don't expect it. Many text editors add a UTF-8 BOM by default, which can lead to subtle bugs.

Modern best practice: use UTF-8 without BOM for web content and data files.

相关术语

UTF-16 UTF-16
每字符使用2或4个字节的可变长度Unicode编码方式,被JavaScript、Java和Windows内部使用。
UTF-32 UTF-32
每字符固定使用4个字节的Unicode编码方式,可直接映射到码位,但存储效率较低。
UTF-8 UTF-8
每字符使用1至4个字节的可变长度Unicode编码方式,是互联网上最主流的编码,被98%以上的网站采用。

相关工具

🔢 Unicode 查询 Unicode 查询
输入 U+1F600 等码位,获取表情符号、编码详情、UTF-8/16 字节和 HTML 实体。