Two strings that look the same#
We compared two spellings of José in Chromium:
| Form | Code points | length | UTF-8 bytes |
|---|---|---|---|
| Composed (NFC) | U+004A U+006F U+0073 U+00E9 | 4 | 5 |
| Decomposed (NFD) | U+004A U+006F U+0073 U+0065 U+0301 | 5 | 6 |
They render the same. === says they are different, and nfc.normalize('NFC') === nfd.normalize('NFC') says they are the same after normalization. A validation pattern such as /^[a-zA-ZÀ-ÿ]+$/ accepts the composed form and rejects the decomposed one, because U+0301 is a combining accent outside that range. Text typed on one system and pasted from another can arrive in either form. MDN: String.prototype.normalize()
Emoji are another common case. In the same test, 👍🏽 (thumbs up with a skin tone) had a length of 4, two code points, and one user-perceived character according to Intl.Segmenter. A field limited by maxlength or by length on the server counts differently from what the user sees.
Capture the code points#
Ask the reporter to run this in the Console with the failing text, or run it on the field yourself with the element selected in the Elements panel ($0):
[...$0.value].map(c => 'U+' + c.codePointAt(0).toString(16).toUpperCase().padStart(4, '0')).join(' ')
Paste the output into the report as code. It survives ticket systems, email and chat, which can normalize, trim or replace characters such as non-breaking spaces.
To rebuild the string, the maintainer turns the list back into text:
String.fromCodePoint(...'U+004A U+006F U+0073 U+0065 U+0301'.split(' ').map(u => parseInt(u.slice(2), 16)))
Characters worth checking for#
| Character | Code point | Common source |
|---|---|---|
| No-break space | U+00A0 | Copied from documents and web pages |
| Zero-width space, joiner or non-joiner | U+200B, U+200D, U+200C | Copied text, emoji sequences, some scripts |
| Byte order mark | U+FEFF | The start of a file or a pasted cell |
| Right-to-left mark, embedding controls | U+200F, U+202B | Mixed-direction text |
| Combining marks | U+0300–U+036F | Decomposed accents |
| Curly quotes and apostrophes | U+2018, U+2019, U+201C, U+201D | Word processors and mobile keyboards |
A code-point list makes each of these visible. On screen, none of them is.
When the personal data is the text#
A failing name or address is personal data. Report its shape, not the value: the code points that matter and a synthetic string with the same structure. For José, U+0065 U+0301 in a name is the evidence; the rest of the name is not needed.
Worked example: a username that could not log in#
This example is fictional. A user can sign up with a username but cannot sign in with it. Support types the username and signs in fine.
The support engineer asks the user to run the code-point snippet in the sign-in field. The output ends in U+0065 U+0301. The user's phone keyboard produced a decomposed é. Signup normalized usernames to NFC before saving; sign-in compared the raw input. The maintainer rebuilt the string with String.fromCodePoint, reproduced the failed sign-in, and normalized sign-in input the same way.
Questions#
Which normalization form should an app use?
It depends on the comparison. NFC is common for storage and display. NFKC also folds compatibility characters, such as full-width letters, which suits identifiers more than free text. The guide's point is narrower: the report must show which form arrived.
The code points match but it still fails. What next?
Check the bytes that reached the server. An encoding mistake, such as text decoded as Latin-1, changes the bytes after the browser. The request's body in the Network panel, copied as curl, shows what was sent.
Does pasting change the text?
It can. The clipboard can carry both plain text and HTML, and the page may read either. Pasted text that fails covers that case.
Return to reproducing what someone else saw for the other layers a replay needs.