Question about URL parameter and Cookie?

superaff1984

Senior Member
Premium Member
Joined
Jun 16, 2010
Messages
991
Reaction score
131
Hi, I have a URL parameter that contains this and it's being put into a cookie as well in the browser.

?clickid=CPOly7oGENUHGNu28uEDILOLzOIHKIYdMNUHOgJVU0ICQ0FKC0xvcyBBbmdlbGVzUgExYhB8zzoDwfdMIYEcgoQsvQ1KagNPUkRyIjliOWNiZjE1ZDg2NjQ5MDRiMDhlMWFmNTFlZjg3ODA3LTI=

However, when I look at the cookie it put into the browser, it's showing this:

CPOly7oGENUHGNu28uEDILOLzOIHKIYdMNUHOgJVU0ICQ0FKC0xvcyBBbmdlbGVzUgExYhB8zzoDwfdMIYEcgoQsvQ1KagNPUkRyIjliOWNiZjE1ZDg2NjQ5MDRiMDhlMWFmNTFlZjg3ODA3LTI%3D

Everything matches, but for some reason at the VERY END when the cookie is inserted it's adding %3D vs =?
 
The %3D is the URL-encoded version of the = symbol, which happens when the value is URL-encoded before being placed into the cookie.
 
Hi, I have a URL parameter that contains this and it's being put into a cookie as well in the browser.

?clickid=CPOly7oGENUHGNu28uEDILOLzOIHKIYdMNUHOgJVU0ICQ0FKC0xvcyBBbmdlbGVzUgExYhB8zzoDwfdMIYEcgoQsvQ1KagNPUkRyIjliOWNiZjE1ZDg2NjQ5MDRiMDhlMWFmNTFlZjg3ODA3LTI=

However, when I look at the cookie it put into the browser, it's showing this:

CPOly7oGENUHGNu28uEDILOLzOIHKIYdMNUHOgJVU0ICQ0FKC0xvcyBBbmdlbGVzUgExYhB8zzoDwfdMIYEcgoQsvQ1KagNPUkRyIjliOWNiZjE1ZDg2NjQ5MDRiMDhlMWFmNTFlZjg3ODA3LTI%3D

Everything matches, but for some reason at the VERY END when the cookie is inserted it's adding %3D vs =?
In terms of URL and URI the '=' is considered a special character and is used to separate the key-value pairs.

If you want to write it in Javascript you need to encodeURI(yourURLParameter) before you write it as cookie. Then you'll need to decodeURI(yourCookie) when trying to read the cookie.
 
Last edited:
Back
Top