Unicode test data
Text that looks right on the screen can still be different text. These values catch code that counts, compares or changes the case of strings without Unicode in mind.
Six values that look harmless
An emoji, as in Kłodzko 🙂. It is one of the characters that take four bytes in UTF-8. The utf8 character set of MySQL, now called utf8mb3, holds at most three bytes a character and cannot store it. utf8mb4 can.
A family emoji, as in Malbork 👩👩👧👦. One picture on the screen, made of seven code points: four people joined by three zero-width joiners. It is 25 bytes in UTF-8 and 11 units in UTF-16. Where a system has no picture for the family, it shows the four people side by side. A limit of 40 counted in one of these and a limit of 40 counted in what the reader sees are different limits, which is why max_length in a recipe takes counted_in: bytes or graphemes as well as characters.
A zero-width space, as in Kętrzyn with one after Kęt. It takes no room on the screen and still makes the value differ from the one without it. In a login or an email address it makes two accounts that look the same. The list below writes it out as a code, so you can see where it is.
The Turkish dotless ı, as in Wıeluń. Turkish has a dotted i and a dotless ı, each with a capital of its own: i and İ, ı and I. Turn Wıeluń into capitals and back and you get wieluń, because the capital of ı is the plain I. The other way round, outside Turkish the capital İ becomes two code points in small letters, an i and a combining dot. Code that changes the case of text to compare it can therefore match values it should not, or miss ones it should.
The same text in another form, as in Giżycko. The letter ż can be one code point, or a z followed by a combining dot above. Both look the same and Unicode treats them as the same text, but a comparison of bytes says they differ. Bring both sides to the same form, usually NFC, before you compare them, as Unicode Standard Annex #15 describes. The list below writes the combining dot out as a code.
A value that changes when normalised twice, as in ᴬᴸᴱᴷsᴬᴺᴰᴿzᴬᴷ. A function that puts this text into small letters and then normalises it to NFKC gives ALEKsANDRzAK the first time and aleksandrzak the second. If your application brings usernames to one form to find duplicates, such a function can send a password reset to somebody else’s account. That happened at Spotify in 2013, and the fix was to refuse names that change on the second pass.
Test data with all six
The recipe below uses Polish names and towns, because writing the same text in another form needs letters with marks, and Polish has plenty. It asks for Unicode characters (UNI) in about three rows in ten.
# Polish names and towns with Unicode that careless code mishandles in about
# three rows in ten: an emoji, a family emoji built from seven code points, an
# invisible zero-width space, a Turkish dotless i, the same text in another
# Unicode form, and a value that changes when it is normalised twice.
#
# The data is Polish because writing the same text in another form needs
# letters with marks. Most of the answers depend on your own rules, and the
# manifest marks them so. It says what to do with every value it changed, and
# lists the damage it could not carry out, with the reason.
#
# qadg generate unicode-test-data.yaml
#
# writes person.csv, expectation-manifest.json and run-note.json. The same seed
# changes the same values on every machine.
version: "0.1"
seed: "unicode-test-data"
locale: pl-PL
entities:
person:
count: 100
fields:
first_name: { generator: first_name, max_length: 40 }
last_name: { generator: last_name, max_length: 40 }
city: { generator: city }
policy:
layers: [UNI]
rows: 30%
per_row: exactly_one
output:
format: csv
Save the recipe, then run this in the same folder. This is what the program printed for it.
$ qadg generate unicode-test-data.yaml person: 100 rows, 3 columns 1 table, 100 rows written 24 defects ordered, 22 applied, manifest in expectation-manifest.json 2 defects could not be applied, and the manifest carries the reason for each one 2 because the values in those rows did not suit them
The recipe ordered 24 defects, and this build applied the 22 below. The other 2 are in the manifest as not applied, each with its reason, and the run above counts them by reason.
UNI.normalization.non_idempotent~ rejectperson 6, column last_name
Aleksandrzak → ᴬᴸᴱᴷsᴬᴺᴰᴿzᴬᴷ
UNI.zero_width.space~ rejectperson 12, column last_name
Świć → Św\u200bić
UNI.case.turkish_dotless_i~ acceptperson 14, column city
Wieluń → Wıeluń
UNI.emoji.basic~ acceptperson 15, column city
Kłodzko → Kłodzko 🙂
UNI.emoji.zwj_sequence~ acceptperson 22, column city
Malbork → Malbork 👩👩👧👦
UNI.normalization.non_idempotent~ rejectperson 32, column first_name
Robert → ᴿᴼᴮᴱᴿᵀ
UNI.zero_width.space~ rejectperson 34, column last_name
Filusz → Fil\u200busz
UNI.case.turkish_dotless_i~ acceptperson 35, column city
Piastów → Pıastów
UNI.emoji.basic~ acceptperson 36, column city
Bolesławiec → Bolesławiec 🙂
UNI.emoji.zwj_sequence~ acceptperson 42, column city
Radom → Radom 👩👩👧👦
UNI.normalization.nfc_vs_nfdacceptperson 45, column city
Giżycko → Giz\u0307ycko
UNI.normalization.non_idempotent~ rejectperson 49, column first_name
Gaja → ᴳᴬᴶᴬ
UNI.zero_width.space~ rejectperson 65, column city
Leszno → Les\u200bzno
UNI.case.turkish_dotless_i~ acceptperson 66, column city
Dąbrowa Górnicza → Dąbrowa Górnıcza
UNI.emoji.basic~ acceptperson 68, column last_name
Wyrostek → Wyrostek 🙂
UNI.emoji.zwj_sequence~ acceptperson 72, column first_name
Mieszko → Mieszko 👩👩👧👦
UNI.normalization.non_idempotent~ rejectperson 83, column first_name
Dominik → ᴰᴼᴹᴵᴺᴵᴷ
UNI.zero_width.space~ rejectperson 86, column last_name
Jóźwiak → Jóź\u200bwiak
UNI.case.turkish_dotless_i~ acceptperson 93, column city
Zielona Góra → Zıelona Góra
UNI.emoji.basic~ acceptperson 96, column last_name
Janiga → Janiga 🙂
UNI.emoji.zwj_sequence~ acceptperson 97, column last_name
Sobków → Sobków 👩👩👧👦
UNI.normalization.nfc_vs_nfdacceptperson 99, column city
Kętrzyn → Ke\u0328trzyn
Most answers are marked ~, because they depend on your rules: an emoji in a city name may be fine in one system and a fault in another. qadg verify reports a disagreement on those and does not fail on it. The same text in another form is marked accept without ~, because it is the same text.
What to check in your code
- Count a length the way its limit means it: in bytes for storage, in graphemes for what a person sees.
- Bring text to one normalisation form, usually NFC, before you compare it or keep it unique.
- Store text in an encoding that holds four bytes a character,
utf8mb4in MySQL. - Decide where invisible characters are allowed, and refuse or remove them in logins and email addresses.
- Test changes of case with the language settings your application runs with, because the result depends on them.
Sources
- Unicode Technical Standard #51, Unicode Emoji, version 18.0, read on 16 November 2026.
- Unicode Standard Annex #15, Unicode Normalization Forms, revision 58, read on 16 November 2026.
- SpecialCasing.txt of the Unicode Character Database, version 18.0.0, read on 16 November 2026.
- The utf8mb3 Character Set, MySQL 8.4 Reference Manual, read on 16 November 2026.
- Mikael Goldmann, Creative usernames and Spotify account hijacking, Spotify Engineering, 18 June 2013, read on 16 November 2026.