Use a servlet filter, like:

public void doFilter(ServletRequest request, ServletResponse response,
                         FilterChain chain)
        throws IOException, ServletException 
    {
        logger.debug("set request character encoding to " + encoding);
        request.setCharacterEncoding(encoding);

        // move on to the next
        chain.doFilter(request, response);
    }

-----Original Message-----
From: Mike Wannamaker [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 12, 2006 4:51 PM
To: 'Tomcat Users List'
Subject: URIEncoding and POSTS


I can specify URIEncoding="UTF-8" in Tomcat's connector settings within the 
server.xml file. Now, my Tomcat server correctly reads the URL GET parameters 
correctly...sending out "Hello, José!" or "Hello, 田中!" as expected. 

However, there's still a problem.

What if I want to POST some non-ASCII data, presumably to enter into a backend 
database? All is well since I set that URIEncoding flag, right?
Wrong. It turns out that Tomcat, doesn't use this URIEncoding flag for POSTed 
form data. So, what does it use? ISO-8859-1 of course! So now, I'm back to 
where I started, and my imaginary application still greets Mr. ç”°ä¸ instead of 
Mr. 田中. Not good.

Why is this so?  Can I get the POST to behave the same as the GET??

Mike Wannamaker
Senior Software Developer 
 


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


Reply via email to