summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-08-23 20:27:07 +0200
committerdefault <nobody@localhost>2024-08-23 20:27:07 +0200
commit1370d6b64e984726c096139ab02f4493e6904e2f (patch)
tree10114b7874469fc96233ddf801d32b6d0bbbfe7d /data.c
parent8586e44de92c827d6a19a7700121c8b21d3687b1 (diff)
Searches are now case-insensitive for all alphabets.
Diffstat (limited to 'data.c')
-rw-r--r--data.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/data.c b/data.c
index cfd20fe..22b821f 100644
--- a/data.c
+++ b/data.c
@@ -11,6 +11,7 @@
#include "xs_time.h"
#include "xs_regex.h"
#include "xs_match.h"
+#include "xs_unicode.h"
#include "snac.h"
@@ -2414,7 +2415,7 @@ xs_list *content_search(snac *user, const char *regex,
if (regex == NULL || *regex == '\0')
return xs_list_new();
- xs *i_regex = xs_tolower_i(xs_dup(regex));
+ xs *i_regex = xs_utf8_to_lower(regex);
xs_set seen;
@@ -2510,10 +2511,12 @@ xs_list *content_search(snac *user, const char *regex,
/* strip HTML */
c = xs_regex_replace_i(c, "<[^>]+>", " ");
c = xs_regex_replace_i(c, " {2,}", " ");
- c = xs_tolower_i(c);
+
+ /* convert to lowercase */
+ xs *lc = xs_utf8_to_lower(c);
/* apply regex */
- if (xs_regex_match(c, i_regex)) {
+ if (xs_regex_match(lc, i_regex)) {
if (xs_set_add(&seen, md5) == 1)
show--;
}