note 61394 added to function.rawurlencode
| From: | djmaze at dragonflycms | Date: | Thu, 02 Feb 2006 11:36:08 +0000 |
| Subject: | note 61394 added to function.rawurlencode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102862@lists.php.net to get a copy of this message | ||
Easier version to 'rickyale at ig dot com dot br' his example
<?php
function encode($text)
{
$REQUEST_URI = str_replace('"', '%22', $text);
// 0 - 128
return preg_replace('#([\x3C\x3E])#e',
'"%".bin2hex(\'\\1\')', $text);
}
?>
Just fill the regular expression with all characters that you need to have encoded.
NOTE: 142 and up in his array are language specific ASCII characters so the conversion to their
unicode ('%C5%BD') equivelant may or may not work for you.
This needs a far more serious and bigger system to handle for non us tables
----
Server IP: 83.137.20.120
Probable Submitter: 80.60.162.189
----
Manual Page -- http://www.php.net/manual/en/function.rawurlencode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61394
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61394&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61394&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61394&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61394&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61394&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61394&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61394&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61394&report=yes
Search -- http://master.php.net/manage/user-notes.php