Fix #11402: Make string filter locale-aware.

This commit is contained in:
Michael Lutz
2023-11-03 20:43:18 +01:00
parent c294eaacc1
commit 86e28e79fb
9 changed files with 173 additions and 5 deletions

View File

@@ -118,9 +118,16 @@ void StringFilter::AddLine(const char *str)
bool match_case = this->case_sensitive != nullptr && *this->case_sensitive;
for (WordState &ws : this->word_index) {
if (!ws.match) {
if ((match_case ? strstr(str, ws.start) : strcasestr(str, ws.start)) != nullptr) {
ws.match = true;
this->word_matches++;
if (this->locale_aware) {
if (match_case ? StrNaturalContains(str, ws.start) : StrNaturalContainsIgnoreCase(str, ws.start)) {
ws.match = true;
this->word_matches++;
}
} else {
if ((match_case ? strstr(str, ws.start) : strcasestr(str, ws.start)) != nullptr) {
ws.match = true;
this->word_matches++;
}
}
}
}