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.