This is really caused by the @ sign. This is not allowed in version 0 cookies. The container will implicitly force it to become version 1 cookie (which breaks in MSIE browsers). Do you want the URL encode cookie value when creating the cookie
Cookie cookie = new Cookie("login", URLEncoder.encode(" someone@example.com ", "UTF-8")); cookie.setMaxAge(2592000); cookie.setDomain("domain.com"); response.addCookie(cookie);
and URL decoding on cookie readings
String value = URLDecoder.decode(cookie.getValue(), "UTF-8");
Please note that you probably should not explicitly set the cookie version to 1.
See also:
Unrelated to a specific problem, cookies are visible and manipulated by the end user or person-in-the-middle. Transferring an email address in a cookie is a bad smell. What if the end user changes it to a different address? Whatever functional requirement (remembering the login?) That you decide to solve with the transfer of the email address into the cookie will most likely be solved differently.
See also:
source share