4 ms·
this is normalization issue, not version issue import unicodedata list(unicodedata.normalize('NFD', "ñ")) >> ['n', '̃'] list(unicodedata.normalize('NFC', "ñ")
by fiedzia 5y ago
this is normalization issue, not version issue
import unicodedata
list(unicodedata.normalize('NFD', "ñ"))
>> ['n', '̃']
list(unicodedata.normalize('NFC', "ñ"))
>> ['ñ']
both are correct, the issue is that unicode allows accented letters to be written as _accented_letter_ or _letter_, _accent_. The idea of "character" in uncicode is not very useful, most of the time you will want graphemes, not codepoints. User-friendliness wise, this is what Python should use (another rant - strings should not have length method, they should have byte_length, codepoint_length and grapheme_length).