note 62848 added to function.setcookie
| From: | Brian at osu1 dot php dot net | Date: | Fri, 10 Mar 2006 19:56:39 +0000 |
| Subject: | note 62848 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-105238@lists.php.net to get a copy of this message | ||
Firefox is following the real spec and does not decode '+' to space...in fact it further
encodes them to '%2B' to store the cookie. If you read a cookie using javascript and
unescape it, all your spaces will be turned to '+'.
To fix this problem, use setrawcookie and rawurlencode:
setrawcookie('cookie_name', rawurlencode($value), time()+60*60*24*365);
The only change is that spaces will be encoded to '%20' instead of '+' and will
now decode properly.
----
Server IP: 64.71.164.2
Probable Submitter: 24.131.141.243
----
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.setcookie.php
Edit -- http://master.php.net/note/edit/62848
Del: integrated -- http://master.php.net/note/delete/62848/integrated
Del: useless -- http://master.php.net/note/delete/62848/useless
Del: bad code -- http://master.php.net/note/delete/62848/bad+code
Del: spam -- http://master.php.net/note/delete/62848/spam
Del: non-english -- http://master.php.net/note/delete/62848/non-english
Del: in docs -- http://master.php.net/note/delete/62848/in+docs
Del: other reasons-- http://master.php.net/note/delete/62848
Reject -- http://master.php.net/note/reject/62848
Search -- http://master.php.net/manage/user-notes.php