IDEA garbled Tomcat output console garbled garbled message garbled

After reinstalling the computer system, reinstall the latest version of IDEA 2019.2.2, garbled. Baidu a lot, slowly solve the garbage problem, it is recorded as follows. Methods vary, different problems different approach.

IDEA first modified coding format file

Set idea file encoding format

The second configuration IDEA Tomcat

When configuring Tomcat, VM options fill -Dfile.encoding = UTF-8

IDEA third modification of the configuration file

IDEA configuration files, or find idea64.exe.vmoptions idea.exe.vmoptions, opened last added in -Dfile.encoding = UTF-8

The fourth print output distortion, distortion return data

Are changing for the better, or find System.out.print ( "Chinese") printed to the console is garbled, the interface returned data is garbled Chinese (configured encodingFilter not OK). If you are a maven project, then add the following code in your pom.xml file

  <properties>
    <!-- 设置项目编码 -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

The fifth Tomcat console garbled modify Tomcat configuration files

java.util.logging.ConsoleHandler.encoding 改为 UTF-8

Sixth Tomcat server.xml

If the request distortion, consider adding at arrow URIEncoding = "UTF-8" 

Code provides information Tomcat listening for HTTP port number. Here we add an attribute: URIEncoding.

The property value to UTF-8, can make the Tomcat (default-ISO-8859-1) to UTF-8 encoding process get request, to avoid Chinese garbled.

 

Guess you like

Origin www.cnblogs.com/ibigboy/p/11519412.html