Learning center

Input that fails only for some text: report the code points

"Saving fails for the name José" can be two different strings. The maintainer types José, it saves, and the report is closed as not reproducible. Text that looks identical on screen can differ in its characters, and copying it through a ticket system can change it again. Report the code points, and the maintainer can rebuild the exact string.

Two strings that look the same#

We compared two spellings of José in Chromium:

FormCode pointslengthUTF-8 bytes
Composed (NFC)U+004A U+006F U+0073 U+00E945
Decomposed (NFD)U+004A U+006F U+0073 U+0065 U+030156

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#

CharacterCode pointCommon source
No-break spaceU+00A0Copied from documents and web pages
Zero-width space, joiner or non-joinerU+200B, U+200D, U+200CCopied text, emoji sequences, some scripts
Byte order markU+FEFFThe start of a file or a pasted cell
Right-to-left mark, embedding controlsU+200F, U+202BMixed-direction text
Combining marksU+0300–U+036FDecomposed accents
Curly quotes and apostrophesU+2018, U+2019, U+201C, U+201DWord 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.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading