As operating systems, browsers, databases, JVM used is not the same character set, based on the development of Weblogic Server Application often garbled Chinese show, in fact, run on Weblogic Server WEB Application There are many characters in the set, the following do a summary, in order to correctly handle Chinese, the best are based on these settings.
1. First joined the paper in JSP
<% @ Page contentType = "text / html; GBK charset ="%>
The designation of the character set used in JSP.
2. In Weblogic.xml document <jsp-descriptor> adding:
<jsp-param>
<param-name> Encoding </ param-name>
<param-value> GBK </ param-value>
</ Jsp-param>
JSP documents specified in the character set used in the JSP document <% @ page contentType = "text / html; GBK charset ="%> cover this setting
3. In Weblogic.xml document <jsp-descriptor> add
<jsp-param>
<param-name> CompilerSupportsEncoding </ param-name>
<param-value> True </ param-value>
</ Jsp-param>
If it is TRUE, JSP compiler specified in the document, a document in the definition of JSP
<% @ Page contentType = "text / html; GBK charset ="%> or <jsp-descriptor> defined in the definition of encoding parameters encoded character set, if it is FALSE, then use the default JVM in the designated character sets coding.
4. Weblogic Server need to HTTP request (GET and POST) of the data from its original coding into Unicode for Java servlet API processing, in order to do this conversion, Weblogic Server needs to know HPPT request the data coding method. This can be done through in the Weblogic.xml <context-param> set.
<input-charset>
<resource-path> / </ Resource-path>
<java-charset-name> GBK </ java-charset-name>
</ Input-charset>
5. ORACLE retrieved from the database by the Chinese do not display the correct time, in such circumstances, if the database using the Chinese character set, and the use of Type 2 JDBC Driver, which may be included in Weblogic.codeset = GBK attribute to solve this problems. Code as follows:
Java.util.Properties props = new java.util.Properties ();
Props.put ( "Weblogic.codeset", "GBK");
Props.put ( "user", "scott");
Props.put ( "password", "tiger");
String connectUrl = "jdbc: Weblogic: oracle";
Driver myDriver = (Driver)
Class.forName ( "Weblogic.jdbc.oci.Driver"). NewInstance ();
Connection conn =
MyDriver.connect (connectUrl, props);
6. If it is used in the WTC call Tuxedo services, in JSP pages does not correctly display the Chinese, must be installed on the server Tuxedo NLS_LANG environment variable in the database and the establishment of the same character set. If the background of the characters in Oracle Database SIMPLIFIED CHINESE_CHINA.ZHS16GBK set to set, then the Tuxedo application server NLS_LANG environment variable should be set to: export NLS_LANG = "SIMPLIFIED CHINESE_CHINA.ZHS16GBK"