https://issues.apache.org/bugzilla/show_bug.cgi?id=47825
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
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Daniel Unfried <[email protected]> 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
error:
javax.servlet.ServletException: Control character in cookie value, consider
BASE64 encoding your value
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
The instructions from http://wiki.apache.org/tomcat/FAQ/CharacterEncoding 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: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]