
The UTF8 BOM in CSV Files and When It Helps or Hurts
Three invisible bytes at the start of a CSV can fix Excel or break a header match. See which readers strip a BOM and how to add or remove one.
Take messy CSV, JSON and spreadsheets and land them in tables without losing a row or a character on the way.

Three invisible bytes at the start of a CSV can fix Excel or break a header match. See which readers strip a BOM and how to add or remove one.

Seeing odd letter pairs where accents belong means UTF-8 was read as a legacy encoding. See the byte level cause and a table of symptoms.

Four encoding detectors gave four different answers on the same six files. See which ones to trust, how to cross check them, and when only the sender knows.

Why accents, euro signs and emoji break in CSV files, how to diagnose each symptom from the bytes, and one routine that converts, loads and checks a file.

Thirty six tiny CSV files that separate good readers from bad ones, with the right answer for each and the readers that missed it in my tests.

TSV avoids most quoting because tabs rarely appear in text, but there are three TSV dialects and they disagree. See where each breaks and which to pick.

Write CSV that survives every reader. Wrap fields with commas, quotes or line breaks, double inner quotes, and round trip test it against four readers.

A CSV stores text, so every reader infers types. Measure what inference costs in time and memory on 2 million rows, and what it breaks: ZIP codes and dates.

Find a file's delimiter in four steps, from looking at the bytes to a quote aware check, and see where Python, DuckDB and qsv sniffers disagree.

A CSV has no flag that says whether row one is a header, so readers guess. Test four files, set the header explicitly, and handle duplicate names.

A CSV from Windows leaves an invisible carriage return on every last column. See it in a shell loop and MySQL, and fix it without damaging quoted fields.

See how a stray comma turns one column into two, what the four quoting states are, and why a backslash does not escape a quote in CSV the way it does in code.
We send one email when a new article is published. No spam.