note 28800 added to function.rawurlencode
| From: | Andrew at rack1 dot php dot net | Date: | Fri, 24 Jan 2003 09:31:00 +0000 |
| Subject: | note 28800 added to function.rawurlencode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42685@lists.php.net to get a copy of this message | ||
note that if you implement your own server request engine in the HTTP manner like:
GET $request_uri
you should first split all parts of the $request_uri path and rawurlencode() each part, then
concatenate those parts back again. this function will translate the URI correctly:
function translate_uri($uri) {
$parts = explode('/', $uri);
for ($i = 0; $i < count($parts); $i++) {
$parts[$i] = rawurlencode($parts[$i]);
}
return implode('/', $parts);
}
because if you do rawurlencode() over the whole URI, path separator characters '/' are
also encoded and request will not happen to be correct. '/' characters should not be
encoded, only those parts in between.
hope this helps someone like me...
--
http://www.php.net/manual/en/function.rawurlencode.php
http://master.php.net/manage/user-notes.php?action=edit+28800
http://master.php.net/manage/user-notes.php?action=delete+28800
http://master.php.net/manage/user-notes.php?action=reject+28800