note 51916 deleted from function.htmlspecialchars by victor
| From: | victor@php.net | Date: | Sun, 17 Apr 2005 14:23:36 +0000 |
| Subject: | note 51916 deleted from function.htmlspecialchars by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-88122@lists.php.net to get a copy of this message | ||
Note Submitter: wanted at gmail dot com
Reason: useless
----
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
?>