Comma-Separated Values (RFC 4180)
Plain-text tabular interchange format notorious for real-world parser edge cases: optional UTF-8 BOMs (`EF BB BF`), multiline quoted cells, doubled quote escapes (`""`), and formula injection.
RFC 4180 permits embedded CRLF line breaks inside double-quoted fields—naive `text.split('\n')` parsers corrupt row counts whenever user comments span multiple lines.
Drop any .csv file (even 100 GB+) to inspect locally
Reads tiny File.slice() header/footer pages in a sandboxed Web Worker · 0 Bytes Uploaded
.csv Magic Bytes & Header Offset Map
| Byte Offset | Length | Data Type | Field Name | Engineering Description |
|---|---|---|---|---|
| 0x00 (opt) | 0 or 3 B | uint8[3] | utf8_bom | Optional Excel UTF-8 BOM (EF BB BF) |
| Row 1 | var | utf8 | header_record | Comma-delimited column names terminated by LF or CRLF |
.csv Security & Polyglot Risk Matrix
Guard against CSV Formula Injection (DDE): sanitize or prefix cells starting with '=', '+', '-', or '@' when exporting user-uploaded CSVs back to Excel/Sheets.
Read .csv Header & Metadata Without Heavy Dependencies
import csv, sys
with open(sys.argv[1], "r", encoding="utf-8-sig", newline="") as f:
reader = csv.reader(f)
headers = next(reader)
print(f"CSV columns ({len(headers)}): {headers}")Deterministic .csv Sample Files & Edge Cases
minimal-rfc4180.csv
Clean 2-row comma-separated table with LF line endings and no BOM.
curl -fsSL https://fileformat.co/fixtures/v1/csv/minimal-rfc4180.csv -o minimal-rfc4180.csv \
&& echo "05718c2daf0ae301a68f435f20cbb9feb8f079fae27efc908a41c41a86daba62 minimal-rfc4180.csv" | shasum -a 256 -corders-unicode-quoted.csv
Realistic UTF-8 CSV containing quoted commas, whitespace padding, and Japanese characters.
curl -fsSL https://fileformat.co/fixtures/v1/csv/orders-unicode-quoted.csv -o orders-unicode-quoted.csv \
&& echo "8dcc3d4302a7e62ad485797bc492f9d5217e8a919469109eed8af219eb4e1354 orders-unicode-quoted.csv" | shasum -a 256 -cutf8-bom-multiline-escaped.csv
Classic parser breaker: starts with `EF BB BF` BOM, uses `\r\n` inside quoted cells, doubled `""` escapes, and ZWJ emoji.
curl -fsSL https://fileformat.co/fixtures/v1/csv/utf8-bom-multiline-escaped.csv -o utf8-bom-multiline-escaped.csv \
&& echo "1550b6c3787e1ad84d709a50341f88dbd2b5ae5a96e5e620e3459a82d0392a5f utf8-bom-multiline-escaped.csv" | shasum -a 256 -cRelated Specifications & Alternatives
Streaming line-oriented text format where every newline-separated record is a standalone UTF-8 JSON value—standard for LLM fine-tuning (SFT/DPO) datasets and batch APIs.
De-facto standard hybrid columnar storage format for modern data lakes (Iceberg, Delta, DuckDB, Spark), placing Thrift Compact Protocol schema and statistics in the file trailer.
ZIP-packaged XML spreadsheet container (`[Content_Types].xml` + `xl/workbook.xml`). Frequently misdiagnosed when backend export endpoints fail and save HTML/JSON error pages as `.xlsx`.