From: Pierre Joye Date: Wed, 23 Aug 2006 20:21:34 +0000 (+0000) Subject: - add support for entities in hexadecimal format, like © can X-Git-Tag: RELEASE_1_0_0RC1~1900 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96aedc6efdcac6916b4718594c8eb4f9b16d2354;p=php - add support for entities in hexadecimal format, like © can be passed as © or © --- diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index a09bdcba6d..6603cd64c3 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -207,12 +207,28 @@ static int gdTcl_UtfToUniChar (char *str, Tcl_UniChar * chPtr) byte = *((unsigned char *) (str + 1)); if (byte == '#') { - for (i = 2; i < 8; i++) { - byte = *((unsigned char *) (str + i)); - if (byte >= '0' && byte <= '9') { - n = (n * 10) + (byte - '0'); - } else { - break; + byte = *((unsigned char *) (str + 2)); + if (byte == 'x' || byte == 'X') { + for (i = 3; i < 8; i++) { + byte = *((unsigned char *) (str + i)); + if (byte >= 'A' && byte <= 'F') + byte = byte - 'A' + 10; + else if (byte >= 'a' && byte <= 'f') + byte = byte - 'a' + 10; + else if (byte >= '0' && byte <= '9') + byte = byte - '0'; + else + break; + n = (n * 16) + byte; + } + } else { + for (i = 2; i < 8; i++) { + byte = *((unsigned char *) (str + i)); + if (byte >= '0' && byte <= '9') { + n = (n * 10) + (byte - '0'); + } else { + break; + } } } if (byte == ';') {