tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 47825] New: Setting Cookie with UTF-8 encoded value gives ServletException for 5.5.26+
Date Fri, 11 Sep 2009 14:56:58 GMT

           Summary: Setting Cookie with UTF-8 encoded value gives
                    ServletException for 5.5.26+
           Product: Tomcat 5
           Version: 5.5.26
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: ErrorMessage
          Severity: normal
          Priority: P3
         Component: Catalina

--- Comment #0 from Daniel Unfried <> 2009-09-11 07:56:55 PDT
Created an attachment (id=24248)
simple Maven2 web project to reproduce the error

Trying to do
  response.addCookie(new Cookie("cookie0", myData));
where myData is a UTF-8 String retrieved through request parameter, all 5.5
versions after and including 5.5.26 produce the following ServletException

javax.servlet.ServletException: Control character in cookie value, consider
BASE64 encoding your value

The instructions from to
handle encodings correctly state:
 - Set URIEncoding="UTF-8" on your <Connector> in server.xml
 - Use a character encoding filter with the default encoding set to UTF-8
 - Change all your JSPs to set the correct Content-Type (use <%@page
contentType="mime/type; charset=UTF-8" %>)

Following these instructions I started out with vanilla installations of 5.25,
5.26, 5.27 and 5.28 on both Windows (Vista64) and Linux (Debian 5.0) using
jdk-1.5.0_12 with the only change from default configuration being the
URIEncoding set to UTF-8 in server.xml. By deploying the sample application
attached the error can be reproduced for 5.5.26+.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message