comparison src/gtkimhtml.c @ 7281:0f7dd6715a90

[gaim-migrate @ 7860] this fixes the &#123; type entities committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 16 Oct 2003 04:35:41 +0000
parents f946af3b0039
children 3a41c3f80228
comparison
equal deleted inserted replaced
7280:f946af3b0039 7281:0f7dd6715a90
755 static gboolean 755 static gboolean
756 gtk_imhtml_is_amp_escape (const gchar *string, 756 gtk_imhtml_is_amp_escape (const gchar *string,
757 gchar **replace, 757 gchar **replace,
758 gint *length) 758 gint *length)
759 { 759 {
760 static char buf[3]; 760 static char buf[6];
761 g_return_val_if_fail (string != NULL, FALSE); 761 g_return_val_if_fail (string != NULL, FALSE);
762 g_return_val_if_fail (replace != NULL, FALSE); 762 g_return_val_if_fail (replace != NULL, FALSE);
763 g_return_val_if_fail (length != NULL, FALSE); 763 g_return_val_if_fail (length != NULL, FALSE);
764 764
765 if (!g_ascii_strncasecmp (string, "&amp;", 5)) { 765 if (!g_ascii_strncasecmp (string, "&amp;", 5)) {
789 } else if (*(string + 1) == '#') { 789 } else if (*(string + 1) == '#') {
790 guint pound = 0; 790 guint pound = 0;
791 if ((sscanf (string, "&#%u;", &pound) == 1) && pound != 0) { 791 if ((sscanf (string, "&#%u;", &pound) == 1) && pound != 0) {
792 if (*(string + 3 + (gint)log10 (pound)) != ';') 792 if (*(string + 3 + (gint)log10 (pound)) != ';')
793 return FALSE; 793 return FALSE;
794 g_snprintf(buf, sizeof(buf), "%c", (gchar)pound); 794 g_unichar_to_utf8((gunichar)pound, buf);
795 *replace = buf; 795 *replace = buf;
796 *length = 2; 796 *length = 2;
797 while (isdigit ((gint) string [*length])) (*length)++; 797 while (isdigit ((gint) string [*length])) (*length)++;
798 if (string [*length] == ';') (*length)++; 798 if (string [*length] == ';') (*length)++;
799 } else { 799 } else {