How to enable reading non-ascii characters in Servlets

Posted by Daziplqa on Stack Overflow See other posts from Stack Overflow or by Daziplqa
Published on 2010-04-13T15:16:22Z Indexed on 2010/04/13 15:32 UTC
Read the original article Hit count: 231

How to make the servlet accept non-ascii (Arabian, chines, etc) characters passed from JSPs?

I've tried to add the following to top of JSPs:

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

And to add the following in each post/get method in the servlet:

request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");

I've tried to add a Filter that executes the above two statements instead of in the servlet.

To be quite honest, these was working in the past, but now it doesn't work anymore.

I am using tomcat 5.0.28/6.x.x on JDK1.6 on both Win & Linux boxes.

© Stack Overflow or respective owner

Related posts about jsp

Related posts about servlets