tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Wong <rw...@opsware.com>
Subject How do I configure Tomcat to translate UTF-8 encoded parameters
Date Tue, 24 Aug 2004 01:07:48 GMT
Hi,

I am using Tomcat 5.0.26.  I configured the HTTP connector to decode URI 
with setting URIEncoding="UTF-8"

      <Connector port="8080" address="${jboss.bind.address}"
         maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
         enableLookups="false" redirectPort="8443" acceptCount="100"
         URIEncoding="UTF-8"
         connectionTimeout="20000" disableUploadTimeout="true"/>

This works for my pages that accept HTTP GET request.  Unicode input 
parameter values that are UTF-8 encoded are properly decoded when 
calling request.getParameter().  However, if the request is HTTP POST, 
the input parameter values are mangled.  Am I missing some configuration 
settings?

I have the following simple JSP page to illustrate the problem.

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title>Testing UTF-8</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

Type in UNICODE characters in input field and click the Submit button.

<h1>Testing UTF-8 using GET</h1>
<form action="<%=request.getRequestURI()%>" method="GET">
<input type="text" name="data" value='<%=request.getParameter("data")%>'/>
<input type="submit" name="submit" value="submit"/>
</form>

<h1>Testing UTF-8 using POST</h1>
<form action="<%=request.getRequestURI()%>" method="POST">
<input type="text" name="data" value='<%=request.getParameter("data")%>'/>
<input type="submit" name="submit" value="submit"/>
</form>

</body>
</html>


--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message