aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpostscriptum <postscriptum@project>2025-05-22 03:34:48 +0300
committerpostscriptum <postscriptum@project>2025-05-22 03:34:48 +0300
commit24105f6e9759b74c04522de1de12ddb77cfba568 (patch)
treecd367a707541dcfee760319f47c21d1ac75c9ab9
parent072ae21013dc924c6bb3378a2480b571a66aba98 (diff)
use utf-8 lowercase function for tags #396
-rw-r--r--activitypub.c2
-rw-r--r--data.c4
-rw-r--r--format.c3
3 files changed, 5 insertions, 4 deletions
diff --git a/activitypub.c b/activitypub.c
index a7e133a..3ff51ad 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -903,7 +903,7 @@ xs_str *process_tags(snac *snac, const char *content, xs_list **tag)
if (*v == '#') {
/* hashtag */
xs *d = xs_dict_new();
- xs *n = xs_tolower_i(xs_dup(v));
+ xs *n = xs_utf8_to_lower(xs_dup(v));
xs *h = xs_fmt("%s?t=%s", srv_baseurl, n + 1);
xs *l = xs_fmt("<a href=\"%s\" class=\"mention hashtag\" rel=\"tag\">%s</a>", h, v);
diff --git a/data.c b/data.c
index e3fa52d..d5dc171 100644
--- a/data.c
+++ b/data.c
@@ -2200,7 +2200,7 @@ void tag_index(const char *id, const xs_dict *obj)
if (*name == '\0')
continue;
- name = xs_tolower_i((xs_str *)name);
+ name = xs_utf8_to_lower((xs_str *)name);
xs *md5_tag = xs_md5_hex(name, strlen(name));
xs *tag_dir = xs_fmt("%s/%c%c", g_tag_dir, md5_tag[0], md5_tag[1]);
@@ -2230,7 +2230,7 @@ xs_str *tag_fn(const char *tag)
if (*tag == '#')
tag++;
- xs *lw_tag = xs_tolower_i(xs_dup(tag));
+ xs *lw_tag = xs_utf8_to_lower(xs_dup(tag));
xs *md5 = xs_md5_hex(lw_tag, strlen(lw_tag));
return xs_fmt("%s/tag/%c%c/%s.idx", srv_basedir, md5[0], md5[1], md5);
diff --git a/format.c b/format.c
index 2f30a0d..0f844cd 100644
--- a/format.c
+++ b/format.c
@@ -8,6 +8,7 @@
#include "xs_json.h"
#include "xs_time.h"
#include "xs_match.h"
+#include "xs_unicode.h"
#include "snac.h"
@@ -443,7 +444,7 @@ xs_str *sanitize(const char *content)
if (n & 0x1) {
xs *s1 = xs_strip_i(xs_crop_i(xs_dup(v), v[1] == '/' ? 2 : 1, -1));
xs *l1 = xs_split_n(s1, " ", 1);
- xs *tag = xs_tolower_i(xs_dup(xs_list_get(l1, 0)));
+ xs *tag = xs_utf8_to_lower(xs_dup(xs_list_get(l1, 0)));
xs *s2 = NULL;
int i;