note 68996 added to function.urldecode
| From: | jeffreyd at davis at gmail dot com | Date: | Fri, 18 Aug 2006 20:05:36 +0000 |
| Subject: | note 68996 added to function.urldecode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116066@lists.php.net to get a copy of this message | ||
As a useful variation on the function rosty dot kerei at gmail dot com wrote, I made a quick
modification to just plain output the html code. That way a javascript encoded url (or say, a get
variable) can actually be written back to the user.
function unicode_urldecode($url)
{
preg_match_all('/%u([[:alnum:]]{4})/', $url, $a);
foreach ($a[1] as $uniord)
{
$utf = '&#x' . $uniord . ';';
$url = str_replace('%u'.$uniord, $utf, $url);
}
return urldecode($url);
}
----
Server IP: 64.71.164.2
Probable Submitter: 70.60.48.210
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.urldecode.php
Edit -- https://master.php.net/note/edit/68996
Del: integrated -- https://master.php.net/note/delete/68996/integrated
Del: useless -- https://master.php.net/note/delete/68996/useless
Del: bad code -- https://master.php.net/note/delete/68996/bad+code
Del: spam -- https://master.php.net/note/delete/68996/spam
Del: non-english -- https://master.php.net/note/delete/68996/non-english
Del: in docs -- https://master.php.net/note/delete/68996/in+docs
Del: other reasons-- https://master.php.net/note/delete/68996
Reject -- https://master.php.net/note/reject/68996
Search -- https://master.php.net/manage/user-notes.php