note 78129 added to function.html-entity-decode

From: Date: Fri, 28 Sep 2007 21:33:03 +0000
Subject: note 78129 added to function.html-entity-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-130896@lists.php.net to get a copy of this message
Actually I am not sure about the regex replacements from numeric entities back. If you give &#039; to a browser. &#39; will also turn into a single quote. But if I do a: <?php chr(039); ?> I will get not a single quote but a heart character (haven't seen it since DOS days :)) However <?php chr(39); ?> gives the correct result. This makes the correct preg something like this <?php $string = preg_replace('~&#x0*([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string); $string = preg_replace('~&#0*([0-9]+);~e', 'chr(\\1)', $string); ?> The reason is also already found on preg_replace manual page: http://de.php.net/manual/en/function.preg-replace.php#69478 039 is interpreted as octal ---- Server IP: 212.124.37.9 Probable Submitter: 62.143.41.87 ---- Manual Page -- http://www.php.net/manual/en/function.html-entity-decode.php Edit -- https://master.php.net/note/edit/78129 Del: integrated -- https://master.php.net/note/delete/78129/integrated Del: useless -- https://master.php.net/note/delete/78129/useless Del: bad code -- https://master.php.net/note/delete/78129/bad+code Del: spam -- https://master.php.net/note/delete/78129/spam Del: non-english -- https://master.php.net/note/delete/78129/non-english Del: in docs -- https://master.php.net/note/delete/78129/in+docs Del: other reasons-- https://master.php.net/note/delete/78129 Reject -- https://master.php.net/note/reject/78129 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130896) next »