Solve Tomcat's Chinese problem _tomcat

Source: Internet
Author: User

Tomcat has a Chinese problem because the character set does not directly support double-byte information such as Chinese. One solution is to simply modify its configuration file, as follows

Add a property named Uriencoding in the Server.xml file that encodes the URL that is passed in the Get method in the HTTP request. The following instructions are used to modify the Server.xml file in the Config folder in the Tomcat installation directory.

Open the Config/server.xml file, and if you haven't modified the file, you should find the following code in it:

Copy Code code as follows:

<connector port= "8080" protocol= "http/1.1"
connectiontimeout= "20000"
redirectport= "8443"/>

This code stipulates that Tomcat listens for information such as the port number of an HTTP request, and can add a property here: uriencoding, set the property value to UTF-8, so that Tomcat no longer handles get requests with iso-8859-1 encoding. The changed code looks like this (the Red section is the newly added code):

Copy Code code as follows:

<connector port= "8080"
Uriencoding= "Utf-8"
Protocol= "http/1.1"
connectiontimeout= "20000"
redirectport= "8443"/>

After this modification, restart Tomcat, and the test succeeds.

The above mentioned is the entire content of this article, I hope you can enjoy.

Please take a moment to share the article with your friends or leave a comment. We will sincerely thank you for your support!

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.