[IntelliJ IDEA] IDEA editor console shows the solution to Chinese garbled characters

Contents of this article

1. Garbled characters

Two, the solution

Step 1. Modify IDEA configuration

Step 2. Modified settings

Step 3. Modify Run/Debug Configurations

Step 4. Restart IDEA


1. Garbled characters

The phenomenon of Chinese garbled characters in IDEA console is as follows:

Two, the solution

The solution to IDEA Chinese garbled characters is as follows.

Step 1. Modify IDEA configuration

Enter the path to the installation directory of idea, enter the bin directory, and find the configuration file corresponding to the computer system. My computer is a 64-bit operating system, so I need to modify the idea64.exe.vmoptions file.

Open the file and add -Dfile.encoding=UTF-8 at the end

 

Step 2. Modified settings

Open IDEA's settings and find the page to set the encoding. The menu path is File --> Settings --> Editor --> File Encodings . (Please Baidu for other editors)

  • (1) Set the default encoding of Global Encoding, Project Encoding, and File (Properties Files/*.properties) to UTF-8.
  • (2) Check the option Transparent native-to-ascii conversion
  • (3) Click the button Apply and OK to apply

 

Step 3. Modify Run/Debug Configurations

Under the Configuration tab, there is a VM options: add -Dfile.encoding=utf-8

 

Step 4. Restart IDEA

If none of the above methods solve your problem, please focus on the following paragraph:

I also saw such a way on the Internet, that is, you may accidentally click on the lower right corner or the encoding there, change it, or somehow it was recorded by the idea in the  encodings.xml file.

When you visit again, it will open the project with that encoding. The solution is: find the .idea folder (for each idea project, there will be a .idea directory ), there is a encodings.xml file in it, and then UTF-8 delete everything except .

 

end!

 

Guess you like

Origin blog.csdn.net/weixin_44299027/article/details/110878284