diff --git a/src/ctype.c b/src/ctype.c index ad0e0976..1355a4ee 100644 --- a/src/ctype.c +++ b/src/ctype.c @@ -175,8 +175,22 @@ int ucd_isspace(codepoint_t c) int ucd_isupper(codepoint_t c) { - return ucd_lookup_category(c) == UCD_CATEGORY_Lu - || ucd_tolower(c) != c; + switch (ucd_lookup_category(c)) + { + case UCD_CATEGORY_Lu: + return 1; + case UCD_CATEGORY_Lt: + return ucd_tolower(c) != c; + case UCD_CATEGORY_Nl: + return (c >= 0x002160 && c <= 0x00216F); // Other_Uppercase + case UCD_CATEGORY_So: + return (c >= 0x0024B6 && c <= 0x0024CF) // Other_Uppercase + || (c >= 0x01F130 && c <= 0x01F149) // Other_Uppercase + || (c >= 0x01F150 && c <= 0x01F169) // Other_Uppercase + || (c >= 0x01F170 && c <= 0x01F189); // Other_Uppercase + default: + return 0; + } } int ucd_isxdigit(codepoint_t c) diff --git a/tools/printdata.py b/tools/printdata.py index 0bee85e2..6e84c67c 100755 --- a/tools/printdata.py +++ b/tools/printdata.py @@ -100,9 +100,11 @@ def isalpha(data): return 0 def isupper(data): - if data.get('LowerCase', null) != null: + if data.get('GeneralCategory', 'Cn') == 'Lu': return 1 - elif data.get('GeneralCategory', 'Cn') == 'Lu': + elif data.get('Other_Uppercase', 0): + return 1 + elif data.get('LowerCase', null) != null: # Some Lt characters have lowercase forms. return 1 else: return 0