Illustrative editorial image generated with AI.
O’Connor, Anne-Marie and van der Waals illustrate a common software mistake: treating punctuation and spaces in names as dirt to remove. A search system may need to find several typed variants, but that is a different task from deciding how a person’s name should be stored or displayed.
Preserve the name the person supplies
W3C’s guidance on personal names explicitly discusses apostrophes, hyphens, spaces and mixed capitalization. A form that accepts only A–Z can reject ordinary names before the user reaches the rest of your service. Automatically turning every word into title case also changes spellings such as “van der Waals.”
Start with a display value that preserves the person’s chosen spelling. If your workflow separately needs a legal-document name, preferred name or pronunciation note, explain each field’s purpose. Do not infer which one a punctuation-free string represents.
Keep search behavior separate from display
A user might type O'Connor with a straight apostrophe while the record contains O’Connor with a typographic apostrophe. You may choose to let search find the record from either input. That does not require overwriting the displayed name. Retain the original value and define search normalization as a separate, documented operation.
Similarly, matching “Anne Marie” to “Anne-Marie” can help someone find a record, but it should produce a candidate rather than establish identity. Different people can share similar names, and removing punctuation creates additional collisions. Never merge two customer records solely because their simplified name keys are equal.
Do not confuse security with deleting names
An apostrophe is legitimate data in a name. It should not become executable database syntax. The OWASP SQL Injection Prevention Cheat Sheet recommends prepared statements with parameterized queries as a primary defense. Removing apostrophes from customer names is not a substitute for separating query code from input data.
The same principle applies when presenting a name in a web page: use the output handling appropriate to that context. A system should be able to store a valid name and display it safely. Avoid making a user alter their identity to compensate for an implementation defect.
A small acceptance-test set
| Input | What to verify |
|---|---|
| O’Connor and O'Connor | Both can be entered; intended search equivalence does not overwrite the stored display value |
| Anne-Marie | The hyphen survives save, export and re-import |
| van der Waals | Spaces and entered capitalization remain intact |
| Two people with the same name | Search shows separate records with permitted disambiguating information |
Use fictional records for testing. Include the actual export formats and integrations your team relies on, not just the form preview. A field can look correct in the browser and still be changed by a CSV import rule downstream.
Review existing data without inventing corrections
If an older system has already removed punctuation, keep an audit of the original imported value and the reason for any correction. Do not automatically insert an apostrophe into every matching surname or infer a hyphen from a search result. Ask the person or use an appropriate authoritative record for the workflow.
Prioritize the places where errors become visible: invoices, event badges, welcome messages and directories. Show the person a preview where possible. A useful correction prompt is “How would you like your name displayed?” rather than asking them to choose between two spellings the system invented.
Specify a complete handoff
Document four decisions for developers and operations: the preserved display field, any separate document-name field, the normalization used only for search, and the evidence required for a merge. Keep stable record identifiers independent of names.
Accents and Unicode representation introduce related issues beyond punctuation. Our Unicode normalization guide explains why visually similar strings can compare differently. Address each layer deliberately: accepting a name, storing it, finding it and identifying the person are connected tasks, but they are not interchangeable.
