js| Solution | problem | show | Chinese
These two days under the Win98 apache1.3.9 plus Jserv and gnujsp1.0,jdk1.2.2,jsdk2.0
Found that Chinese can not display correctly. Either garbled or wrong.
After the Netizen reminds, summed up the following several methods.
1: Modify locale: Select locale in the control plate, set to English (United States). nbsp
And then back up. Everything is normal.
2: Add a statement to the JSP page:
<%@ page contenttype= "text/html;charset=gb2312"%>?
The 琷 SP display is normal.
3: Add code options when compiling the servlet and JSP. Compiling the servlet using
Javac-encoding iso8859_1 Myservlet.java
In the JSP's zone configuration file. Modify the compilation parameters to:
Compiler=builtin-javac-encoding Iso8859_1
After using this method, you will not need to make any other changes to the normal display of Chinese.
4: The most soil method, in the servlet source program to add code transformation statements. Such as
try{
Out.println (New String ("I Love You"). GetBytes ("GBK"), "Iso8859_1")
}
catch (Unsupportedencodingexception e)
{
.......
}
Use this method must pay attention to capture unsupportedencodingexception