Bom problem of UTF-8
The Unicode specification has the concept of BOM. Bom -- byte order mark, that is, the byte mark, that is, the signature.
There is a character named "Zero Width no-break space" in the UCS encoding, and its encoding is feff. Fffe does not exist in the UCs, so it should not appear in actual transmission. We recommend that you transmit the character "Zero Width no-break space" before transmitting the byte stream in the UCS specification ". In this way, if the receiver receives feff, it indicates that the byte stream is big-Endian; if it receives fffe, it indicates that the byte stream is little-Endian. Therefore, the character "Zero Width no-break space" is also called Bom.
The UTF-8 does not need BOM to indicate the byte order, but BOM can be used to indicate the encoding method. The UTF-8 code for the character "Zero Width no-break space" is ef bb bf. So if the receiver receives a byte stream starting with ef bb bf, it will know that this is UTF-8 encoding.
Windows uses BOM to mark the encoding of text files.
Although the signature has many advantages, in actual situations, many software do not recognize the signature, such as the JavaProgramSometimes, after editing and saving the XML file, the program will not recognize it because of BOM.
Attachment notepad Editor, which opens the text file of UTF-8 encoding, and then selects [file]-> [encoding]-> [UTF-8]
Click Save to remove the BOM. If you select [file]-> [encoding]-> [UTF-8 contains signature], add Bom.
Notepad editor notepadv4.1.24.62