--- a/pidgin/gtkimhtml.c Tue Sep 19 20:19:47 2017 +0200
+++ b/pidgin/gtkimhtml.c Sun Nov 19 03:43:01 2017 +0100
@@ -2052,44 +2052,48 @@
gtk_smiley_tree_lookup (GtkSmileyTree *tree,
+ gunichar text_ch = g_utf8_get_char(text);
- if(*x == '&' && (amp = purple_markup_unescape_entity(x, &alen))) {
+ if((amp = purple_markup_unescape_entity(text, &alen))) { + const char *amp_next = g_utf8_next_char(amp); /* Make sure all chars of the unescaped value match */
- pos = strchr (t->values->str, *amp);
+ while (g_utf8_get_char(amp_next)) { + pos = g_utf8_strchr (t->values->str, -1, g_utf8_get_char(amp)); t = t->children [GPOINTER_TO_INT(pos) - GPOINTER_TO_INT(t->values->str)];
+ amp_next = g_utf8_next_char(amp_next);
- pos = strchr (t->values->str, *amp);
+ pos = g_utf8_strchr (t->values->str, -1, g_utf8_get_char(amp)); - else if (*x == '<') /* Because we're all WYSIWYG now, a '<'
+ else if (text_ch == '<') /* Because we're all WYSIWYG now, a '<' * char should only appear as the start of a tag. Perhaps a safer (but costlier)
* check would be to call gtk_imhtml_is_tag on it */
- pos = strchr (t->values->str, *x);
+ alen = g_unichar_to_utf8 (text_ch, NULL); + pos = g_utf8_strchr (t->values->str, -1, text_ch); @@ -2099,8 +2103,9 @@
+ text = g_utf8_next_char(text); + text_ch = g_utf8_get_char(text);