The comma is part of the http-header value definition, so url-encode commas in your cookie value.
URLEncoder.encode(cookieValue);
I found this:
"This [cookie value] string is a sequence of characters excluding
semi-colon, comma and white space. If there is a need to place such
data in the name or value, some encoding method such as URL style %XX
encoding is recommended, though no encoding is defined or
required"
The RFC says:
Informally, the Set-Cookie response header comprises the token Set-
Cookie:, followed by a comma-separated list of one or more cookies.
Each cookie begins with a NAME=VALUE pair, followed by zero or more
semi-colon-separated attribute-value pairs.
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 :