note 51916 added to function.htmlspecialchars
| From: | wanted at gmail dot com | Date: | Thu, 14 Apr 2005 21:45:19 +0000 |
| Subject: | note 51916 added to function.htmlspecialchars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88033@lists.php.net to get a copy of this message | ||
If you would like to translate URL encoded with %xx such as:
http%3A//www.torrentresource.com/%3Fsomething
try this function:
<?
// Translate %xx by his corresponding ascii value.
function html2ascii($data) {
for ($i=0; $i < strlen($data) ;$i++)
if ($data[$i] == '%') {
$data = str_replace(substr($data,$i,3),
chr(base_convert(substr($data,$i+1,2),16,10)),$data);
}
return $data;
}
print html2ascii("http%3A//www.torrentresource.com/%3Fsomething");
// returns: http://www.torrentresource.com/?something
?>
----
Manual Page -- http://www.php.net/manual/en/function.htmlspecialchars.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51916
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51916&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51916&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51916&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51916&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51916&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51916&report=yes
Search -- http://master.php.net/manage/user-notes.php