First, find out what is the bom header? When you save a text file in UTF-8 format with a program such as Notepad in Windows, notepad will add a few invisible characters (ef bb bf) before the file header ), is the so-called BOM (Byte order Mark ).
It is not limited to files stored in Notepad, as long as the file's opening contains several invisible characters of ef bb bf (the hexadecimal format should be xEFxBBxBF, which can be seen by binary editing files ). This is like a convention, and when the system sees it, it will feel that your file is UTF-8-encoded.
If your interface is UTF-8, you need to force download a file, such as csv. excel considers csv as GB encoded by default (in Chinese), so if the rice has a bom header, the file you present to the user may be garbled.
How can I add a bom header?
Add the bom header before the output file:
|The code is as follows:||Copy code|
// File name