Python - Isalpha() Returns True On Unicode Modifiers
Solution 1:
U+02c7 CARON is a codepoint in the Lm (Modifier Letter) category, so according to the Unicode standard, it is alphabetic.
The documentation for str.isalpha()
makes it clear what is included:
Alphabetic characters are those characters defined in the Unicode character database as “Letter”, i.e., those with general category property being one of “Lm”, “Lt”, “Lu”, “Ll”, or “Lo”.)
You didn't define what you mean by work properly; clearly you have a different definition of what constitutes an alphabetic letter. If you only expected Latin-1 letters, then you need to limit also need to test if the string can be encoded safely to Latin-1. There are exactly zero Lm-category codepoints in the Latin-1 subset of Unicode (and no Lt characters either, and only 2 Lo characters, ª (U+00AA) and º (U+00BA)).
Post a Comment for "Python - Isalpha() Returns True On Unicode Modifiers"