From 5b107678601a8545c03416cc227e53c6723c25e2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 28 Jun 2021 20:03:29 +0530 Subject: [PATCH] Case folding should happen after diacritics removal not before --- src/calibre/db/sqlite_extension.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/db/sqlite_extension.cpp b/src/calibre/db/sqlite_extension.cpp index ee2656d8cb..2caf9440ba 100644 --- a/src/calibre/db/sqlite_extension.cpp +++ b/src/calibre/db/sqlite_extension.cpp @@ -268,11 +268,12 @@ private: } if (is_token) { icu::UnicodeString token(str, token_start_pos, token_end_pos - token_start_pos); - token.foldCase(U_FOLD_CASE_DEFAULT); + token.foldCase(); if ((rc = send_token(token, token_start_pos, token_end_pos, stemmer)) != SQLITE_OK) return rc; if (!for_query && remove_diacritics) { - icu::UnicodeString tt(token); + icu::UnicodeString tt(str, token_start_pos, token_end_pos - token_start_pos); diacritics_remover->transliterate(tt); + tt.foldCase(); if (tt != token) { if ((rc = send_token(tt, token_start_pos, token_end_pos, stemmer, FTS5_TOKEN_COLOCATED)) != SQLITE_OK) return rc; }