0

I am setting the following as a cookie value:

%7B%22url%22%3Anull%2C%22landing_page%22%3A%22%2F%2Fwww.site.com%2FcookieTest.php%3Ftf_campaign%3Dgeneric_1402879093%26tf_source%3Dgoogle%26tf_medium%3Dpaid%26tf_content%3D54001912063_269225209373%26tf_term%3Dcrear%2520encuestas%2520online%26tf_dv%3Dc%26gclid%3DCjwKCAjwg_fZBRAoEiwAppvp-ZSUc6duu05XYtUl0ZdDAaULDtnpbAiwou-N7DDqagPsFZ4VTE56SBoCsVEQAvD_BwE%22%2C%22date%22%3A%222018-07-05%2018%3A29%3A25%22%7D

However when I look at the value in the cookie stored, it is different and shows this:

%7B%22url%22%3Anull%2C%22landing_page%22%3A%22%2F%2Fwww.site.com%2FcookieTest.php%3Ftf_campaign%3Dgeneric_1402879093%26tf_source%3Dgoogle%26tf_medium%3Dpaid%26tf_content%3D54001912063_269225209373%26tf_term%3Dcrear%2520encuestas%2520online%26tf_dv%3Dc%26gclid%3DCjwKCAjwg_fZBRAoEiwAppvp-ZSUc6duu05XYtUl0ZdDAaULDtnpbAiwou-N7DDqagPsFZ4VTE56SBoCsVEQAvD_BwE%22%2C%22date%22%3A%222018-07-05%2018%3A29%3A25%22%7D

Can can I make it so the cookie value is exactly the same as the first string and not the second ? Therefore without the %5C

  • Both samples you have provided are identical. I understand you want to convert `%5C` to a backslash, can you give an example of how you are encoding the string before saving it as a cookie? – NewToJS Jul 06 '18 at 00:19
  • Hi @NewToJS they aren't identical, the latter includes %5C .... but the former does not. Why when I use the former as a cookie value does javascript add a %5C ??? – Jake Stainer Jul 06 '18 at 00:24
  • Please give a working example of how your are encoding and setting/saving the cookie. I will add a backslash into the example string so I can work with the same as what you currently have. Also I cannot see why a URL would contain a backslash – NewToJS Jul 06 '18 at 00:27
  • Check this out: https://jsfiddle.net/vcdghLrj/ – Jake Stainer Jul 06 '18 at 00:31
  • Where is `$cookie` defined? I cannot work with that since it's showing `=` as a syntax error so if you are using other languages to import values then you need to be clear about that in your question description.... for example a server-side language like `php` – NewToJS Jul 06 '18 at 00:42

0 Answers0