GUIDE深度 · Deep dive
CSV Quoting Rules
CSV is not just comma-separated: fields containing commas, quotes or newlines need double quotes, and inner quotes are doubled. Otherwise a parser splits one field into several.
When to quote
The field contains the delimiter (comma, semicolon or tab).
The field contains a double quote; double it.
The field contains a newline.
BOM and encoding
Excel UTF-8 CSV may include a BOM, adding an invisible character to the first header.
Save as UTF-8 and strip the BOM when needed; do not mix GBK and UTF-8.
FAQ
What if a field contains a comma?
Wrap it in double quotes: "a,b".
Why is the first header odd?
Likely a BOM; strip it or save as UTF-8 without BOM.