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!