Text and Data Formats
-
Encoding and Decoding Text Files
Encoding turns text into bytes according to a named convention. A reader uses the same convention to recover the text.
-
Leading and Continuation Bytes in UTF-8
A UTF-8 character may occupy several bytes. The first byte indicates the sequence length, while following bytes follow a continuation pattern.
-
Choosing a Text Decoding Error Policy
Invalid encoded input can be rejected, be replaced with a visible marker, or be handled under another explicitly documented rule.
-
Byte Order Marks at the Start of Text
Some Unicode formats use an initial mark to convey an encoding convention. UTF-8 can optionally use its byte representation as a signature.
-
LF and CRLF in Text Records
A text format can use one or more bytes as a line ending. Reader settings determine whether those endings appear distinct in decoded strings.
-
Reading Unicode Code Point Notation
A Unicode code point names a value in the Unicode codespace. Its hexadecimal identifier is distinct from how an encoding writes it.
-
Separators and Escaping in Text Formats
A delimiter needs a rule to distinguish separators from literal data bearing the same spelling.
-
Reading CSV with Embedded Commas
CSV readers treat commas inside quoted fields as data under the applicable dialect, so rows require a format-aware parser.
-
Quotes and Newlines Inside CSV Fields
A quoted CSV field can include delimiters, escaped quotation marks, and under common CSV rules an embedded line break.
-
Column Names and Field Order in CSV
A CSV header assigns names to column positions when the file is declared to include one. A reader needs a policy for absent or repeated names.
-
Missing and Empty Fields in Delimited Rows
An empty field occupies a position. A missing field changes the number of fields available to a reader.
-
JSON Objects, Arrays, and Their Roles
JSON arrays store ordered values. JSON objects associate string names with member values under the format's object rules.
-
JSON Null Versus an Absent Member
An object can contain a name whose value is null, or omit the name entirely. Those records can carry different application meanings.
-
JSON Numbers Across Different Runtimes
JSON specifies a number syntax, while readers may store the parsed value in different numeric representations.
-
One JSON Value Per Line
A line-oriented JSON convention groups one encoded JSON value per logical line so a reader can process one record at a time.
-
Reading Escaped Characters in JSON
JSON string syntax uses escapes to represent characters whose literal use would interfere with the string grammar or is convenient to encode.
-
Plain Text and Structured Text Files
A structured text format has a grammar defining record boundaries, field names, or types. Following that grammar is how a reader recovers data.
-
Versioning a Serialized Record
A version or a compatible format contract helps a reader interpret records produced by different editions of a program.
-
Reading Length-Prefixed Records
A length-prefixed format records the size of a payload before its bytes, so payload characters need not serve as delimiters.
-
Delimiter and Length Framing
A byte stream needs record boundaries if it carries several messages. Delimiters and lengths supply different framing rules.
-
Required and Optional Data Fields
A schema can state which named fields must be present and which optional ones can use a defined default or absent state.
-
Structural and Domain Validation of Data
Structural validation checks that a record has the intended fields and types. Domain validation checks the rule those values are meant to obey.
-
Escaping and Character Encoding
Escaping follows a textual grammar to distinguish special data. Character encoding maps the resulting text into bytes.
-
File Extensions, Signatures, and Structure
An extension records a naming convention. A signature and a parser inspect evidence contained within the file.
-
Line Numbers and Byte Offsets in Diagnostics
A file diagnostic can identify a source line and column or the exact position in serialized bytes. The two measurements answer different questions.
-
Storing Timestamps and Durations
A timestamp identifies an observation time under a declared convention. A duration measures the difference or a length of time.
-
Keeping Exact and Normalized Field Spellings
The same application can preserve a source field for display and derive a normalized key for comparison.
-
When a Record Round Trip Is Lossless
A round trip is lossless relative to specified information. It can preserve a parsed value while changing formatting, member order, or exact bytes.
-
Reading a Small Data Schema Example
A useful schema example reveals field names, types, constraints, and the treatment of values that do not follow those expectations.
-
Designing a Small Data Exchange Contract
A data exchange specification should name the encoding, record structure, required fields, and handling of invalid or newer values.