Fix casing issues with non-ASCII characters in contact search.

SQLite's case-related stuff is ASCII-only. That means that even though LIKE is supposed to be case-insensitive, it fails when used on non-ASCII characters.

There appears to be no relief in SQLite itself, so I swapped our contact search to use GLOB instead of LIKE and wrote a little thing to convert query strings into a case-insensitive unicode-compatible patterns. Didn't see any noticeable performance difference.
This commit is contained in:
Greyson Parrelli
2020-07-22 22:36:10 -04:00
parent 5f9c0c3204
commit 5bf15b0587
2 changed files with 41 additions and 16 deletions

View File

@@ -61,4 +61,11 @@ public final class StringUtil {
public static boolean isVisuallyEmpty(char c) {
return Character.isWhitespace(c) || WHITESPACE.contains(c);
}
/**
* @return A string representation of the provided unicode code point.
*/
public static @NonNull String codePointToString(int codePoint) {
return new String(Character.toChars(codePoint));
}
}