tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Supporting accented characters in URL with URIEncoding=UTF-8
Date Tue, 04 Dec 2007 17:18:05 GMT
Rohit Seth wrote:
> 1. Added URIEncoding="UTF-8" in connector element.
> 2. Modified code to set encoding for request and response.
> 
> After these changes we are observing following behavior:
> 
> 1. If url doesn't contain any special character, everything is fine.
> 2. If url contains a latin character like õñü, value gets corrupted.
The connector is expecting UTF-8 so if you have characters encoding in
something other than UTF-8 it is going to fail.

> 3. If url contains a UTF-8 character like ます, values are proper. In this
> case even the latin characters are also correct.
> 
> I would appreciate any help / insight .

Try this as a starting point. It should work for any input on a clean
Tomcat install. If you set URIEncoding="UTF-8" on the connector it should
work with GET as well as POST.

<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
   <head>
     <title>Character encoding test page</title>
   </head>
   <body>
     <p>Data posted to this form was:
     <%
       request.setCharacterEncoding("UTF-8");
       out.print(request.getParameter("mydata"));
     %>

     </p>
     <form method="post" action="index.jsp">
       <input type="text" name="mydata">
       <input type="submit" value="Submit" />
       <input type="reset" value="Reset" />
     </form>
   </body>
</html>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message