Whitespace test values
Characters that take up space, or claim to, and are impossible to see in a form. 12 values, each with what it breaks and what a correct application does instead.
Type them one at a time with AltShiftN
in the palette, or take them all into a script with nkb emit whitespace.
Trailing space
whitespace/trailing-space
Kowalski
Kowalski\u0020
- ends with a space
- 9 graphemes
- 9 code points
- 9 bytes
- 9 UTF-16 units
- What it breaks
- Login and e-mail comparisons differ between browser and server; the account is created but cannot be found.
- What a correct application does
- Trimmed everywhere or preserved everywhere - never one on sign-up and the other on sign-in.
Leading space
whitespace/leading-space
Kowalski
\u0020Kowalski
- starts with a space
- 9 graphemes
- 9 code points
- 9 bytes
- 9 UTF-16 units
- What it breaks
- Sorting puts the record at the top of every list, and exact-match search never finds it.
- What a correct application does
- Same trimming rule as everywhere else in the application.
A single space
whitespace/space-only
\u0020
- starts with a space
- ends with a space
- 1 grapheme
- 1 code point
- 1 byte
- 1 UTF-16 unit
- What it breaks
- The browser counts the field as filled and the server counts it as empty, or the other way round.
- What a correct application does
- One consistent verdict on both sides about whether this field is empty.
Three zero-width spaces
whitespace/zero-width-space-x3
abcd
ab\u200B\u200B\u200Bcd
- 3 zero-width characters
- 7 graphemes
- 7 code points
- 13 bytes
- 7 UTF-16 units
- What it breaks
- Character counters, comparison and deduplication see a different value than the human does.
- What a correct application does
- Stored and returned unchanged, or rejected with a message that names the characters.
Non-breaking space between words
whitespace/nbsp-between-words
JanKowalski
Jan\u00A0Kowalski
- 1 space that is not an ordinary space
- 12 graphemes
- 12 code points
- 13 bytes
- 12 UTF-16 units
- What it breaks
- Search for a plain-space spelling never finds the record; exports and mail merges keep the invisible difference forever.
- What a correct application does
- Treated as a space by search, or normalised on save - consistently.
Newline in a single-line field
whitespace/newline-in-single-line
JanKowalski
Jan\u000AKowalski
- 1 line break
- 12 graphemes
- 12 code points
- 12 bytes
- 12 UTF-16 units
- What it breaks
- A single-line field that accepts a line break breaks CSV export, log lines and every list view below it.
- What a correct application does
- Rejected, or stored with the break preserved and escaped on export.
Tab inside a value
whitespace/tab-inside
JanKowalski
Jan\u0009Kowalski
- 1 tab
- 12 graphemes
- 12 code points
- 12 bytes
- 12 UTF-16 units
- What it breaks
- Tab-separated exports split one record into two columns; column alignment in reports collapses.
- What a correct application does
- Rejected or escaped on export - never passed through raw into a delimited format.
Carriage return and newline inside a value
whitespace/crlf-in-value
JanKowalski
Jan\u000D\u000AKowalski
- 2 line breaks
- 12 graphemes
- 13 code points
- 13 bytes
- 13 UTF-16 units
- What it breaks
- Two line-ending conventions in one field make the same text compare as different across systems.
- What a correct application does
- Normalised to one convention on save, or preserved and escaped consistently.
A single zero-width space
whitespace/zwsp-only
\u200B
- 1 zero-width character
- 1 grapheme
- 1 code point
- 3 bytes
- 1 UTF-16 unit
- What it breaks
- A field that looks empty but is not: required-field validation passes, and the record has no usable name.
- What a correct application does
- Treated as empty by validation, or shown in a way that reveals the field is not empty.
Ogham space mark
whitespace/ogham-space
abcd
ab\u1680cd
- 1 space that is not an ordinary space
- 5 graphemes
- 5 code points
- 7 bytes
- 5 UTF-16 units
- What it breaks
- A character in the space category that renders as a visible line - it breaks both trimming and layout assumptions.
- What a correct application does
- Handled like any other whitespace character, or rejected with a message.
Three spaces between words
whitespace/many-spaces-between
JanKowalski
Jan Kowalski
- 14 graphemes
- 14 code points
- 14 bytes
- 14 UTF-16 units
- What it breaks
- Search, deduplication and printed output treat runs of spaces inconsistently between layers.
- What a correct application does
- Collapsed on save or preserved on save - one rule, applied everywhere.
A thousand spaces
whitespace/len-1000-spaces
1,000 ×
- starts with a space
- ends with a space
- 1,000 graphemes
- 1,000 code points
- 1,000 bytes
- 1,000 UTF-16 units
- What it breaks
- Character-by-character trimming and layouts that do not wrap; a thousand spaces is still a short value by character count.
- What a correct application does
- Rejected or trimmed - never accepted and stored in full.