JSP Chinese link/tomcat Chinese path

Source: Internet
Author: User

There is no problem when uploading files with Chinese names on the web, but there is a problem during the download. After some searching, it turns out that Tomcat does not support Chinese paths and Chinese files by default, if you download Tomcat directly from the Apache site, whether it is the installation version of the EXE file or
Decompress the ZIP file, built-in for get protocol URL encoding are ISO-8859-1, this character set cannot directly support Chinese and other double byte information, and the download link of the Chinese file is
It is implemented through the get protocol. However, you only need to modify the configuration file. The specific method is as follows:

Add a property named uriencoding to the server. xml file to encode the URL passed by the get method in the HTTP request. Repair
Modify the server. xml file in the config folder in the tomcat installation directory.

Open the config/server. xml file. If the file has not been modified, you can find the following code in it:

<Connector Port = "8080" protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443" type = "regxph" text = "yourobjectname"/>


This Code specifies Tomcat listening for HTTP request port number and other information, you can add a property here: uriencoding, set this property value to UTF-8, you can let
Tomcat no longer processes get requests in the ISO-8859-1 encoding. The changed code is as follows (the red part is the newly added code ):

<Connection Port = "8080"
Uriencoding = "UTF-8"

Protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443" type = "regxph" text = "yourobjectname"/>

In this way, restart Tomcat and the test is successful.

Related Article

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.