Methods of dealing with garbled characters in J2EE project development

The solution to the problem of garbled characters encountered in J2EE development:

We all know that many encoding methods can be used in development: gbk, utf-8, gb2312, etc. Now in companies, utf-8 encoding is generally used.

The encoding settings involve the following aspects:
          1. The encoding method of the URL you submit is parsed by default in Tomcat. The default is iso8859-1. We teach you to modify it to utf-8. If you use the post submission method, you can skip it. Modification, because the post value is not passed through the url, but the entity in http. If it is considered carefully, it is set to utf-8;          
          2. The encoding method of the file in the project and the browser parsing method are both set to utf-8 , this is relatively simple and will not be explained one by one; 

       
          3. Set the encoding method of the request to utf-8 through the filter, which can basically solve most of the garbled problems;

code show as below:

 

Configuration information:

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326638970&siteId=291194637