Collection 06

Data

Interpret bytes, fields, and records without guessing.

Data entries begin with the smallest sample that exposes the format. They show where a record starts and ends, which bytes are ambiguous, and what a parser is entitled to ignore.

Index

On this shelf

NameFormatInterpretation question
Quotes and Line Breaks in CSV Reference CSV When is a line break part of a field instead of a record boundary?
Recognizing a UTF-8 BOM Reference Encoding How do I detect a BOM, and should I remove it?
Record Boundaries in JSON Lines Reference JSON What separates two records, and why can a pretty-printed object not be one line?
Testing for NULL in SQL Question & Answer SQL Why does column = NULL never match, and what should I write instead?
Can You Average Two p95 Latencies? Question & Answer Statistics What information do two p95 values lose about the combined request stream?

Reading path

A way in

Start with the BOM entry when an otherwise valid text file begins with invisible bytes. The CSV and JSON Lines entries show two different answers to where a record ends.

  1. 01 Recognizing a UTF-8 BOMA UTF-8 BOM is the byte sequence EF BB BF at the start of a text stream; inspect the first three bytes before decoding, and strip it unless the consuming format explicitly expects it.
  2. 02 Quotes and Line Breaks in CSVA line break belongs to a CSV field only when it appears inside a double-quoted field; outside quotes it ends the record, so wrap the field in double quotes and double any embedded quotes.
  3. 03 Record Boundaries in JSON LinesIn JSON Lines each record is one complete JSON value on a single line, with LF as the record separator; a pretty-printed object spans multiple lines and is therefore not valid JSON Lines.

All entries

Full catalog