Win2000 Tomcat Chinese garbled solution

xiaoxiao2021-03-06  102

These two days will be put into Tomcat 4.3.1 in Win2000, J2SDK1.4.1 found Chinese could not display properly. Either garbled or wrong. After the netizen reminded, there are several methods. 1: Modify the area setting: Select the area setting in the control panel, set to English (US)? NBSP; then restart. Everything is normal. 2: Add a statement in the JSP page: <% @ page contentType = "text / html; charset = GB2312"%>, the display is normal. 3: Add the code option when compiling servlet and JSP. Compiling servlet Use Javac -Encoding ISO8859_1 MyServlet.java in the JSP's ZONE configuration file. Modify compile parameters are: compiler = Builtin-Javac -Encoding ISO8859_1 After using this method, you can display Chinese normally. 4: The most soil, add the code transformation statement in the servlet source program. Su Try {OUT.PRINTLN (NEW ("I love you")). GetBytes ("GBK"), "ISO8859_1")} Catch (unsupportedEncodingexcection e) {.......} Use this method must pay attention to capture UnsupportedEncodingexception

转载请注明原文地址:https://www.9cbs.com/read-63655.html

New Post(0)