Fix non-ASCII search on database (#18437)

Use `ToASCIIUpper` for SQLite database on issues search, this because `UPPER(x)` on SQLite only transforms ASCII letters. Resolves #18429
This commit is contained in:
Gusted authored and GitHub committed 2022-02-01 20:59:25 +08:00
1 parent 7f2530e004
commit bb5f859ec0
3 files changed
+52 -1

No files matched your search

+11
View File
@@ -170,3 +170,14 @@ func CryptoRandomBytes(length int64) ([]byte, error) {
_, err := rand.Read(buf)
return buf, err
}
// ToUpperASCII returns s with all ASCII letters mapped to their upper case.
func ToUpperASCII(s string) string {
b := []byte(s)
for i, c := range b {
if 'a' <= c && c <= 'z' {
b[i] -= 'a' - 'A'
}
}
return string(b)
}