Hi Xu,

Encoding is/can be a real pain. You have to ensure it is consistent
throughout the web application to stand any chance. Start with the
server.xml with the following declaration:-

<Connector port="80" redirectPort="443" URIEncoding="UTF-8"
useBodyEncodingForURI="true" />

I also use a filter to set the following:-

request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8"); 
response.setCharacterEncoding("UTF-8");

Within the final html output I always include the following meta tag:-
<meta http-equiv="Content-Type" content="text/xhtml;
charset=utf-8"></meta>

Not sure all steps are required but they work for me. Of course if you
use a database this also needs to support UTF-8 or your chosen encoding.

Hope this helps
Rob


> -----Original Message-----
> From: xu cheng [mailto:xcheng....@gmail.com]
> Sent: 16 November 2010 05:59
> To: users@tomcat.apache.org
> Subject: the tomcat encoding
> 
> hi all:
> I wrote an app and there are some chinese content, and there are some
code
> like this
> 
> str = new String(chineseContentString.getBytes("iso-8859-1"),
"utf-8");
> 
> the app runs pretty well in the tomcat of my pc. however ,when it was
> deployed in other machine.
> all the Chinese content becomes messy code.
> 
> so ,does anyone know how to got to encoding of the tomcat. or it was
just
> iso-8859-1 and cannot be changed?
> 
> thanks
> by the way , the edition is 6.0.20

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to