Fix lower case conversion bug for some characters
Bug: 7232296
Change-Id: Iaf3f6be55f1bdc2294533938bb54fedcf25fb0cb
diff --git a/native/jni/src/char_utils.h b/native/jni/src/char_utils.h
index b17f262..20cf2e8 100644
--- a/native/jni/src/char_utils.h
+++ b/native/jni/src/char_utils.h
@@ -23,7 +23,9 @@
namespace latinime {
inline static bool isAsciiUpper(unsigned short c) {
- return isupper(static_cast<int>(c)) != 0;
+ // Note: isupper(...) reports false positives for some Cyrillic characters, causing them to
+ // be incorrectly lower-cased using toAsciiLower(...) rather than latin_tolower(...).
+ return (c >= 'A' && c <= 'Z');
}
inline static unsigned short toAsciiLower(unsigned short c) {