tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Bromley <martin.brom...@sustainable-energy.co.uk>
Subject Re: Request parameter data not being recognised as UTF-8
Date Fri, 22 Jul 2005 15:47:35 GMT
If you take a look at the API docs for ServletRequest.setCharacterEncoding(), they say 

"This method must be called prior to reading request parameters or reading input using getReader()."

By the time execution gets to your JSP page, something has probably read your request parameters
- maybe an MVC controller servlet of some sort.

Martin

Tim Koop wrote:
> Thanks Mikolaj.  That did it.
> 
> For some reason running request.setCharacterEncoding("UTF-8") in my code 
> does nothing, but if it gets run from a Filter it works great.
> 
> Tim Koop
> 
> 
> 
> Mikolaj Rydzewski wrote:
> 
>> Tim Koop wrote:
>>
>>> I have a web page form that is expecting UTF-8 data, but when my code 
>>> gets the data, the getParameter() methods don't return the right 
>>> thing.  I have to run this code to get the right thing:
>>>
>>> String value = new 
>>> String(request.getParameter("fieldName").getBytes("ISO-8859-1"), 
>>> "UTF-8");
>>
>>
>>
>> Please take a look at SetCharacterEncodingFilter servlet in Tomcat's 
>> example apps. It does the job you need. Its sources are located in 
>> webapps/jsp-examples/WEB-INF/classes/filters (at least in Tomcat 5.5).
>>
>> Regards
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
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