problems displaying chinese chars. with utf-8 encoding
Posted on 2006-07-11
From last two days, i m having nightmare with displaying chinese characters in a web page. I have done everything, seems required. The characters are displayed properly but the html page generated is incomplete.
Please note: The html generated by the servlet engine is incomplete. Seems a problem with the JspServlet..but have no idea.
The things i did
Option 1) Use the following directives and meta tags
<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
...etc (get chinese content from database)
Option 2) to simplify and avoid adding these lines in all jsps, i just use a Servlet filter to set the response character encoding..
Apart from that, the tomcat web.xml is properly set for javaEncoding like
On the backend, oracle db is used and has NLS_CHARACTERSET set to AL32UTF8.
I am not talking about uri encoding or anything on the request params. Just wish to display the page properly. Any ideas??