Apache1.3.9 and jserv, gnujsp1.0, jdk1.2.2, jsdk2.0 are installed in win98 these two days.
Chinese characters cannot be displayed normally. Either garbled or error.
I summarized the following methods as a reminder.
1: Modify region settings: select the region settings in the control panel and set it to English (US )? Nbsp;
Then restart. Everything works.
2: add a statement to the jsp page:
<% @ Page contentType = "text/html; charset = gb2312" %>?
The sp display is normal.
3: add the code option when compiling servlet and jsp. Compile servlet usage
Javac-encoding iso8859_1 myservlet. java
In the zone configuration file of jsp, modify the compilation parameters:
Compiler = builtin-javac-encoding ISO8859_1
After using this method, you can display Chinese characters without any other changes.
4: add the code transformation statement to the servlet Source program. For example
Try {
Out. println (new String ("I Love You"). getBytes ("GBK"), "ISO8859_1 "))
}
Catch (UnsupportedEncodingException e)
{
.......
}
When using this method, be sure to capture UnsupportedEncodingException