The page entry box that appears after the upgrade of Tomcat the solution to the problem of garbled Chinese characters __ garbled problem

Source: Internet
Author: User

I upgraded my Web application from tomcat5.0.30 to 5.5.26, found that the static text of the page is normal, but the page input box input in Chinese, in the background of the action layer check found that Chinese into garbled, in the action of the 5.5.26 environment using the following statement test:

System.out.println (New String (Scode.getbytes ("iso-8859-1"), "GBK");

Discovery can be converted to Chinese, indicating that the 5.5.26 environment of the page input box character set for Iso-8859-1, in the 5.0.30 environment such conversion is garbled, the Description 5.0.30 The character set of the page input box is GBK, and I have <%@ page on my pages. Contenttype= "text/html; CHARSET=GBK "%>,

And in the Web.xml also configured GBK character set filter, then why go from 5.0.30 to 5.5.26, the page input box to enter the Chinese will be iso-8859-1, and the other text on the page is normal, and then online check, in the tomcat5.5.26 conf/ Server.xml in the connector tag plus uriencoding= "GBK", garbled problem disappeared, see below:

<connector port= "8080" maxhttpheadersize= "8192"
maxthreads= "minsparethreads=" maxsparethreads= "75"
Enablelookups= "false" redirectport= "8443" acceptcount= "100"
connectiontimeout= "20000" disableuploadtimeout= "true" uriencoding= "GBK"/>

Description: There are several connector, note that this specifies the Tomcat run port.

Later compared the configuration of 5.0.30, found that 5.0.30 Server.xml also set uriencoding= "GBK", only to upgrade Tomcat did not pay attention to it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.