0

I am working on a PHP 5.3 production server, so html_entity_decode($, ENT_XML1) is not available.

My question is simple: What is the conversion method for example for Ÿ to a byte?

Cobra_Fast
  • 15,671
  • 8
  • 57
  • 102
  • 159 is a control character – Quentin Jan 13 '14 at 16:32
  • Are you sure `html_entity_decode` function isn't available in your php version? it's built-in and available since php v4.3. have you tried it with `function_exists()`? in any case, have a look at this -> http://uk3.php.net/html_entity_decode#51055 – Latheesan Jan 13 '14 at 16:33
  • @LatheesanKanes It's available, but `ENT_XML1` to decode any decimal entity is not, so it misses some. – Cobra_Fast Jan 13 '14 at 16:36

1 Answers1

0
$str = preg_replace('/&#(\d+);/me', 'chr(\\1)', $str);

Seems to be a hack for this problem.
Found at http://php.net/html_entity_decode#47371.

But I still don't understand the logic behind it.

Cobra_Fast
  • 15,671
  • 8
  • 57
  • 102