CSV file Comma Separator Value (Comma-separated values ). Intermediate files commonly used for data conversion exist, such as exporting data from Mysql to CSV and importing CSV to SqlServer. CSV fileComma Separator Value (Comma-separated values ). Intermediate files commonly used for data conversion exist, such as exporting data from Mysql to CSV and importing CSV to SqlServer. In linux, php exports table data from the mysql database to csv according to the conditions, and uses UTF-8 encoding to export CSV files, after opening the file, Chinese characters are garbled (CSV files in Windows are associated with Microsoft Excel by default). It can be opened normally with Notepad ++ or Word, but the layout is messy. The reason is: BOM. What is BOM?? Byte Order Mark (bid ). To identify Unicode files, Microsoft recommends that all Unicode files start with zero width nobreak space. This is used as a "feature" or "byte-order mark (BOM) to identify the encoding and byte order (big-endian or little-endian) used in the file. the specific relationship is shown in the table below. BOM is not used in Unix-like systems because it breaks the syntax conventions of existing ASCII files. Code: Note: When writing a csv file, make sure that the php source code is UTF-8 without BOM and no content is output. If a webpage (*. html) has a BOM, a magical blank line will appear when it is opened under IE6.x, which is not found in Firefox. |