Client side ==================================================================== For HTML pages: add header encoding as following <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB2312"> <meta http-equiv="Content-Language" content="zh-cn"> </head> <body> …… </body> </html>For JSP page: In order to communicate with the browser using Chinese character, the contentType attribute of the pages have to be set as <%@ page contentType="text/html; charset=GB2312" %> Server side =========================================================================== To send Chinese to browserFor servlet: the responses of the servlets need to set contentType to support Chinese character before getting writers from these responses. response.setContentType("text/html; charset=GB2312"); Writer out = response.getWriter();For JSP: the response of the JSP files also need to set contentType to support Chinese character <%response.setContentType("text/html; charset=GB2312");%> To receive Chinese from browser For Tomcat 3.3, there is a special Interceptor in Tomcat 3.3 called DecodeInterceptor. Interceptors alias modules are configurable parts of software that constitute Tomcat 3.3. These parts of software participate in request processing. The interceptors=modules are configured in Tomcat 3.3 via conf/server.xml file. And it is possibly in other xml configuration files. In server.xml, we have one item <DecodeInterceptor />which handles the task of establishing the encoding of a request. User can setup DecodeInterceptor for different encoding method. <DecodeInterceptor useSessionEncoding="true" >
====================================================================
For HTML pages: add header encoding as following
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<meta http-equiv="Content-Language" content="zh-cn">
</head>
<body>
……
</body>
</html>For JSP page: In order to communicate with the browser using Chinese character, the contentType attribute of the pages have to be set as
<%@ page contentType="text/html; charset=GB2312" %>
Server side
===========================================================================
To send Chinese to browserFor servlet: the responses of the servlets need to set contentType to support Chinese character before getting writers from these responses.
response.setContentType("text/html; charset=GB2312");
Writer out = response.getWriter();For JSP: the response of the JSP files also need to set contentType to support Chinese character
<%response.setContentType("text/html; charset=GB2312");%>
To receive Chinese from browser
For Tomcat 3.3, there is a special Interceptor in Tomcat 3.3 called DecodeInterceptor. Interceptors alias modules are configurable parts of software that constitute Tomcat 3.3. These parts of software participate in request processing. The interceptors=modules are configured in Tomcat 3.3 via conf/server.xml file. And it is possibly in other xml configuration files. In server.xml, we have one item <DecodeInterceptor />which handles the task of establishing the encoding of a request. User can setup DecodeInterceptor for different encoding method. <DecodeInterceptor useSessionEncoding="true" >