What's the difference between UTF-8 and UTF-8 without BOM?

前端 未结 21 1443
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 05:45

What\'s different between UTF-8 and UTF-8 without a BOM? Which is better?

21条回答
  •  一整个雨季
    2020-11-21 06:28

    UTF-8 without BOM has no BOM, which doesn't make it any better than UTF-8 with BOM, except when the consumer of the file needs to know (or would benefit from knowing) whether the file is UTF-8-encoded or not.

    The BOM is usually useful to determine the endianness of the encoding, which is not required for most use cases.

    Also, the BOM can be unnecessary noise/pain for those consumers that don't know or care about it, and can result in user confusion.

提交回复
热议问题