View Full Version : Hex htmlentities

11-24-2003, 03:39 AM
I'm checking a couple of things in phpDig 1.6.4.

In robot_functions.php, the function phpdigCleanHtml has a line:$text = ereg_replace('&#([0-9]+);',chr('\1').' ',$text);
I guess that this line recognises entities such as ' & # 233; ' as being lowercase e with acute accent.

I see no code to recognise equivalent entities such as ' & # x e9; '. If these hex entities aren't currently recognised, could the code be added to recognise them?

11-24-2003, 05:13 PM
Hi. In robot_functions find:

$text = ereg_replace('&#([0-9]+);',chr('\\1').' ',$text);

and replace with:

while (eregi('&#([0-9]{3});',$text,$reg)) {
$text = str_replace($reg[0],chr($reg[1]),$text);
while (eregi('&#x([a-f0-9]{2});',$text,$reg)) {
$text = str_replace($reg[0],chr(base_convert($reg[1],16,10)),$text);

11-27-2003, 06:48 AM
Thanks. I'll make a test as soon as I can.

12-08-2003, 02:44 AM
Works OK for me now. Thanks.