From 4a56b57be746b828a67b621c7fd6c7c134f64e09 Mon Sep 17 00:00:00 2001 From: grunfink Date: Thu, 18 Dec 2025 09:36:16 +0100 Subject: If the emoji starts with &#, convert to an utf-8 string. --- activitypub.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/activitypub.c b/activitypub.c index e1f3210..59df31a 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1643,7 +1643,22 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid_o) dict = xs_dict_set(dict, "type", "Emoji"); tag = xs_list_append(tag, dict); } + else + if (xs_startswith(emo, "&#")) { + /* snac default emoji as an HTML entity: decode */ + content = xs_free(content); + + xs *s1 = xs_strip_chars_i(xs_dup(emo), "&#"); + unsigned int cpoint = 0; + sscanf(s1, "%u;", &cpoint); + + if (cpoint) + content = xs_utf8_cat(xs_str_new(NULL), cpoint); + else + content = xs_dup(emo); + } else { + /* use as it is and hope for the best */ xs_free(content); content = xs_dup(emo); } -- cgit v1.2.3