I have problem with getting value from cookie that contains commas. It returns not full string but string cut off to first comma. For example:
// cookie value = var1,var2,var3
String cookieVal = cookie.getValue();
//cookieVal now is "var1" instead of "var1,var2,var3"
and
// cookie value = var1=var2=var3
String cookieVal = cookie.getValue();
//cookieVal now is "var1=var2=var3"
What am i doing wrong.
The comma is part of the http-header value definition, so url-encode commas in your cookie value.
I found this:
The RFC says:
Update: After you clarified that you are parsing a cookie from google: I looked through all my __utmX cookies and none of them contains commas. The delimiter there is
|
or url-encoded:
Are you sure you need to store a set in the cookie? IMHO cookies should not be used to store data apart from identifiers. Data storage should be done on the server-side whenever possible.
Take a look at the Cookie Documentation. It says :
And if you see the setValue method you will find this
EDIT: Just read the google thing. Maybe try setting the version to 1 and see how it works.