kip
Person name formatting / normalisation - feedback request
TLDR; Seeking feedback on what, if any, normalisations and validations should be provided when accepting input that represents a person’s name.
Context
When you accept input for the name of a person, what validation or normalisation do you normally do?. CLDR 48 will be out very soon and with it new releases of many of the ex_cldr libraries.
One of these is ex_cldr_person_names which supports formatting names in a locale-sensitive way. I have an opportunity to provide some validations or normalisations as optional capabilities.
Person Name Validation - current practise
When implementations allow entry of person names, they can be too strict; there are instances where people can’t enter their real names, such as O’Brian, Stéphanie, Wałęsa, Þjóðólfr.
When you accept input for a person’s name do you:
- Do nothing - as long as its UTF-8 it’s ok?
- Restrict to a single script? Maybe thats too lenient - even the Latin script has over 1_400 characters in it
- Do you allow emoji characters, like the name B
b? - What about the always fun Zalgo text?
Possible normalisations
- Transform to Unicode NFC format
- Replacement of arbitrary sequences of whitespace characters by a single space .
- \p{whitespace}{2,∞} → U+0020
- Replacement of U+2010 HYPHEN and U+2011 NON-BREAKING HYPHEN
- [‐‑] → -
Additional possible constraints
- Too many identical grapheme clusters in a sequence
- (Tóóóóóm)
- Too many non-letters in a row
- (Jean—Luc Jr.., MD)
- Too many combining marks in a row
- Faruq̣̣̈̈
Not in scope
Removing profane words or otherwise accepting or rejecting words according to some dictionary.
Most Liked
thousandsofthem
josevalim
I usually just leave it free form. Because if someone wants to have fun with your name input, they will be able to, even with only ASCII characters. And once you allow a bit of Unicode, which you need to anyway, it already opens up too many possibilities.
mudasobwa
In my humble opinion, the general purpose library should not try to satisfy needs of any weird restrictive software behind the business/govt websites/apps. If they don’t allow anything but ASCII-7, they would be perfectly able to filter it out on their own.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








