Comment

Comment by jph

An email falsehood surprised me recently: I thought a case-insensitive email address can be compared by using pseudocode `lower(x)`. But that's false.

An email system that guarantees case-insensitive email addresses can still fail during comparisons of lowercase-to-lowercase, due to international encodings, locales, I18N, L10N, etc.

Pseudocode:

    string-compare-case-insensitive(x, y) => true // Right way

    string-compare(lower(x), lower(y)) => false // Wrong way
It turns out this issue is called a "case folding non-deterministic" error, and is a broader issue with strings in general.

For more about "case folding" with Unicode: http://www.unicode.org/Public/UNIDATA/CaseFolding.txt

For more about "non-deterministic" comparisons: https://www.postgresql.org/docs/current/collation.html#COLLA...

parent jph 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton