Jquery stop HTML encoding cookie

cookies, escaping, html-encode, jquery

Solution

jquery.cookie is encoding the comma by default. To override this just do:

$.cookie.raw = true;

Problem

I'm using this short snippet of code: ``` var d = itemID + "," + quantity; var CookieData = $.cookie("storebasket"); if(CookieData == null || CookieData == "") { $.cookie("storebasket", d, { path: '/', expires: 60 }); } else { $.cookie("storebasket", CookieData + "|" + d, { path: '/', expires: 60 }); } ``` However the value ALWAYS becomes HTML encoded. For example: ``` 5%2C1 ``` Which when decoded with this tool is: ``` 5,1 ``` I've tried using `unescape` but no luck: ``` $.cookie("storebasket", unescape(d), { path: '/', expires: 60 }); ``` Any more ideas?

Original source

Related problems