--- a/libpurple/util.c Tue Feb 19 19:46:49 2008 +0000 +++ b/libpurple/util.c Tue Feb 19 19:51:03 2008 +0000 @@ -921,6 +921,7 @@ { const char *pln; int len, pound; + char temp[2]; if (!text || *text != '&') return NULL; @@ -943,8 +944,10 @@ pln = "\302\256"; /* or use g_unichar_to_utf8(0xae); */ else if(IS_ENTITY("'")) pln = "\'"; - else if(*(text+1) == '#' && (sscanf(text, "&#%u;", £) == 1) && - pound != 0 && *(text+3+(gint)log10(pound)) == ';') { + else if(*(text+1) == '#' && + (sscanf(text, "&#%u%1[;]", £, temp) == 2 || + sscanf(text, "&#x%x%1[;]", £, temp) == 2) && + pound != 0) { static char buf[7]; int buflen = g_unichar_to_utf8((gunichar)pound, buf); buf[buflen] = '\0';