Reputation: 415
I am using PHP to create cookie using
setcookie("key", "value@value");
but if we check the cookie in browser resources it shows value%40value
.
I need it to be value@value
When I created cookie using Java, I see proper value value@value
.
I already tried urldecode
and urlencode
functions. None of them worked.
Upvotes: 1
Views: 112
Reputation: 1837
You need to be using setrawcookie(). Take a look at what the docs have to say on the subject:
Note that the value portion of the cookie will automatically be urlencoded when you send the cookie, and when it is received, it is automatically decoded and assigned to a variable by the same name as the cookie name. If you don't want this, you can use setrawcookie() instead if you are using PHP 5.
Upvotes: 2