aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-12-18 09:36:16 +0100
committergrunfink <grunfink@comam.es>2025-12-18 09:36:16 +0100
commit4a56b57be746b828a67b621c7fd6c7c134f64e09 (patch)
treeda1f1248ee046d29acae71b95a92d74f796bd4c6
parent765cd34527052970892ca33b80fd977c37b6b608 (diff)
If the emoji starts with &#, convert to an utf-8 string.
-rw-r--r--activitypub.c15
1 files changed, 15 insertions, 0 deletions
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);
}