Re:Falsehoods programmers believe about email
by landofredwater on Thursday September 01, 2022 @12:55AM
(#32672163)
What would the mechanism behind case-insesitive string compare be? How would you program out all the edge cases?
[ Parent
| on HN ]
Re:Falsehoods programmers believe about email
by umanwizard on Thursday September 01, 2022 @01:06AM
(#32672231)
By implementing the Unicode’s case folding specification in detail, as described in section 5.18 of the Unicode standard.
Or, more likely, by using a library like ICU.
Re:Falsehoods programmers believe about email
by silon42 on Thursday September 01, 2022 @03:23AM
(#32673117)
it is host specific.
Re:Falsehoods programmers believe about email
by bmn__ on Thursday September 01, 2022 @06:43AM
(#32674530)
Unicode does not depend on a host. You probably meant something else, and the expression came out wrong.
Care to explain in more detail?
Re:Falsehoods programmers believe about email
by PeterisP on Thursday September 01, 2022 @08:25AM
(#32675364)
As Unicode standard describes (e.g. the same 5.18 section mentioned above) case mapping depends on locale, so lowercasing the same string may have different results on different hosts, and so also the truthfulness of lowercase(x)==lowercase(y) is not universal and depends on the host locale.
See the standard https://www.unicode.org/versions/Unicode11.0.0/ch05.pdf for the most commonly used example of Turkish i, but there are others.
Re:Falsehoods programmers believe about email
by Dylan16807 on Thursday September 01, 2022 @02:14PM
(#32680644)
If you're setting up proper case folding, part of your job is not leaving locale up to the host.
Re:Falsehoods programmers believe about email
by Quekid5 on Thursday September 01, 2022 @11:07AM
(#32677426)
Indeed, a fundamental to the problem is that most unicode text doesn't actually carry the relevant locale information... (Of course, one probably wouldn't want to rely on sender-specified locales for email adresses when deciding address equality -- that would open one up to all sorts of potential weird scenarios, i.e. a nightmare for security).
Re:Falsehoods programmers believe about email
by connicpu on Thursday September 01, 2022 @01:04AM
(#32672221)
Presumably the case-insensitive version is also doing unicode normalization as well, which is what a byte-level comparison of tolower versions would miss
Re:Falsehoods programmers believe about email
by kubanczyk on Thursday September 01, 2022 @03:13AM
(#32673058)
A primer (taken straight from GP's first link):
> the full case foldings are superior: for example, they allow "MASSE" and "Maße" to match.
Re:Falsehoods programmers believe about email
by skupig on Thursday September 01, 2022 @03:22AM
(#32673107)
This sounds like a fun vulnerability to find in a password reset flow
Re:Falsehoods programmers believe about email
by thrdbndndn on Thursday September 01, 2022 @04:14AM
(#32673481)
Yeah but isn't email address in ascii? I still have no idea why it would be different.
Re:Falsehoods programmers believe about email
by umanwizard on Thursday September 01, 2022 @01:33PM
(#32679965)
> isn't email address in ascii?
Yes in the basic SMTP RFC, but there are extensions that allow non-ascii local-parts.