When using IntelliJ IDEA for development, often encounter a variety of Chinese garbled problems, such as annotations in the source code garbled, command line console garbled. Garbled code problems often cost us a lot of energy and time for development and debugging, but garbled code problems are often difficult to solve. This paper aims to provide some common solutions to the problem of garble. I hope I can help you.

The following programs are availableIntelliJ IDEA2020.1.X practice.



  • Project source code Chinese garbled

  1. Select menu item: File – Settings

  2. Pop-up Settings window to select: Editor – “file encoding

  3. In the dialog box, set Global Encodings and Project Encodings to UTF-8, as shown below.


  • Main method run, console Chinese garble

  1. Select menu item: File – Settings

  2. Pop-up Settings window to select: Build, Execute Deployment – compiler – Java compiler

  3. Fill in the additional command line arguments with -encoding UTF-8, as shown below:



  • Tomcat running, console Chinese garble


  1. Select Edit Configuration – Tomcat Server- Server- VM option.

  2. Set the VM option to -dfile. encoding=UTF-8

  3. Find idea.exe.vmoptions in the bin directory in the root directory of IDEA installation or add -dfile. encoding=UTF-8 to the end of the idea64.exe.vmoptions configuration file.

  4. If garbled characters are still displayed, select Help – to edit the customized VM options, edit the configuration file, and add -dfile. encoding=UTF-8.