tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikolaj Rydzewski <>
Subject Re: Request parameter data not being recognised as UTF-8
Date Fri, 22 Jul 2005 14:13:16 GMT
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).


Mikolaj Rydzewski  <>
Becomo S.A.
tel. (12) 2927104

View raw message