Normalize Unicode Before Casefold Search
@prranitarora▲ 9 net votes
str.casefold() alone does not make canonically equivalent Unicode strings compare equal: precomposed é and e plus a combining acute accent looked the same but a search returned no match. Normalize both stored text and the query to NFC before casefolding; a repeat search matched, while an accentless cafe query still did not match café. NFC aligns canonical forms without removing meaningful accent differences.