tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vwu98...@lycos.com
Subject Re: Encoding Issue on POST
Date Sat, 01 Jan 2011 18:40:42 GMT
Thanks very much André. Please see the below

----- Original Message -----
From: "André Warnier" <aw@ice-sa.com>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Saturday, January 1, 2011 4:26:28 AM GMT -08:00 US/Canada Pacific
Subject: Re: Encoding Issue on POST

vwu98034@lycos.com wrote:
> The followings are what I have done for a project in regarding of encoding.
> 
> * <%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%> on the first
line of JSP files
> * <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

That looks fine.

> * Set URIEncoding="UTF-8" on your <Connector> in server.xml

That matters for a GET, but plays no role for a POST.


> * An encoding filter for utf-8. 

Can you expand on that ?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The code can be found on the follow page: 

http://www.devdaily.com/java/jwarehouse/spring-framework-2.5.3/src/org/springframework/web/filter/CharacterEncodingFilter.java.shtml

and the configuration in web.xml is the following:

<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   
> While the form GET method works correctly for encoding, the form POST doesn't. I need
the following codes to get the right encoding for data coming from a form POST method:
> 
> 		try{
> 
> 			tmp = new String(str.getBytes("ISO-8859-1"), "UTF-8");
> 		}catch(Exception ex){}
> 

How exactly are you obtaining "str" in the above ?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The str is the input string which carries data from the form.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@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