In the project, if the page is submitted in the form of get, the Chinese will appear garbled.
We have two ways to solve the problem of garbled characters.
The first kind: Add get commit garbled solution in the program
New String (Username.getbytes ("iso-8859-1"),"UTF-8");
This way as long as there is a need, each method needs to add get garbled problem resolution code, the total seems to be quite troublesome.
Second: Directly modify the configuration of Tomcat, a one-time solution to the global get commit garbled problem.
Find the Tomcat configuration used for your project in 1.eclipse, open the Server.xml file
2. Locate the configuration line where port 8080 is located, and add uriencoding= "UTF-8". You can resolve the global get commit garbled.
Note: This approach solves the global get commit garbled. You will not need to resolve the get commit garbled in the project in the future.
Note: After the modification we can open the Tomcat installation directory. Go inside the Conf configuration folder
Open the Server.xml configuration file inside
It can be found that the eclipse changes are synced to Tomcat.
This also tells us that the get commit garbled problem in other projects is no longer solved.
If this time you in your program to add a similar to the following to resolve the Get Submit method garbled problem resolution code, but will be garbled.
New String (Username.getbytes ("iso-8859-1"),"UTF-8");
Modify Tomcat configuration in Eclipse to resolve global get commit garbled problem