Fortunately you can usually outsource this to a UI toolkit which can do it.
By the way, try looking up the standardized Unicode casefolding algorithm sometime, it is a thing to behold.
in particular, the differences between NFC and NFKC are "fun", and rather meaningful in many cases. e.g. NFC says that "fi" and "fi" are different and not equal, though the latter is just a ligature of the former and is literally identical in meaning. this applies to ffi too. half vs full width Chinese characters are also "different" under NFC. NFKC makes those examples equal though... at the cost of saying "2⁵" is equal to "25".
language is fun!
naIak•2h ago
UnicodeDecodeError