note 97969 added to function.urlencode
| From: | davis dot peixoto at gmail dot com | Date: | Wed, 19 May 2010 01:53:57 +0000 |
| Subject: | note 97969 added to function.urlencode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169384@lists.php.net to get a copy of this message | ||
urlencode function and rawurlencode are mostly based on RFC 1738.
However, since 2005 the current RFC in use for URIs standard is RFC 3986.
Here is a function to encode URLs according to RFC 3986.
<?php
function myUrlEncode($string) {
$entities = array('%21', '%2A', '%27', '%28',
'%29', '%3B', '%3A', '%40', '%26',
'%3D', '%2B', '%24', '%2C', '%2F',
'%3F', '%25', '%23', '%5B', '%5D');
$replacements = array('!', '*', "'", "(",
")", ";", ":", "@", "&", "=",
"+", "$", ",", "/", "?", "%",
"#", "[", "]");
return str_replace($entities, $replacements, urlencode($string));
}
?>
----
Server IP: 187.16.23.128
Probable Submitter: 189.58.82.181
----
Manual Page -- http://www.php.net/manual/en/function.urlencode.php
Edit -- https://master.php.net/note/edit/97969
Del: integrated -- https://master.php.net/note/delete/97969/integrated
Del: useless -- https://master.php.net/note/delete/97969/useless
Del: bad code -- https://master.php.net/note/delete/97969/bad+code
Del: spam -- https://master.php.net/note/delete/97969/spam
Del: non-english -- https://master.php.net/note/delete/97969/non-english
Del: in docs -- https://master.php.net/note/delete/97969/in+docs
Del: other reasons-- https://master.php.net/note/delete/97969
Reject -- https://master.php.net/note/reject/97969
Search -- https://master.php.net/manage/user-notes.php