前言
windows对于utf-8编码的文件自带BOM,但是其他系统utf-8编码默认不带BOM,就造成在某些情况下字符解码会出现问题,比如python自带的json在读取在window下编码得来的utf-8文件时,会报如下错误:
ValueError: No JSON object could be decoded
BOM
From Wikipedia, the free encyclopedia
BOM:The byte order mark (BOM) is a Unicode character, U+FEFF BYTE ORDER MARK (BOM), whose appearance as a magic number at the start of a text stream can signal several things to a program consuming the text:
- What byte order, or endianness, the text stream is stored in;
- The fact that the text stream is Unicode, to a high level of confidence;
- Wh