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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to