Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

Time:2021-3-24

abstractIn this paper, four methods are summarized to solve the Chinese garbled problem of IntelliJ idea console perfectly.

preface

If IntelliJ idea is not configured, the problem of Chinese garbled code in the console will be very serious, which will seriously affect our access to information and program tracking. This paper summarizes the following four points to solve the problem of Chinese garbled on the console, hoping to help you.

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

be carefulAccording to the summary of my daily work experience, the order is the order we need to pay attention to. After each modificationBe sure to restart IntelliJ idea for the configuration to take effect

1、 Modify the virtual machine output options of the current web project Tomcat server

Top navigation bar “run → edit configurations…” Enter the configuration page, modify the virtual machine output option VM options of the current web project Tomcat server, and add it- Dfile.encoding=UTF -8 。 After restart, run the program to check the console information. If it doesn’t work, please perform the following steps.

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

2、 Modify IntelliJ idea global code, project code and attribute file code

Top navigation bar “file → settings…” Enter the configuration page, slide down to “file encodings” in “editor”, and set global encoding, project encoding and default encoding for properties files to UTF-8 respectively. After restart, run the program to check the console information. If it doesn’t work, please perform the following steps.

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

3、 Custom virtual machine options in IntelliJ idea

Top navigation bar “help → etit custom VM options…” Enter the custom virtual machine options page.

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

In idea 64 exe.vmoptions Add at the end of the file- Dfile.encoding=UTF -8。 After restarting, run the program to check the console information. Generally, the problem is solved at this step. Of course, if it doesn’t work, please perform the following stepsSuper step

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

4、 Directly modify the encoding information of IntelliJ idea configuration file

We open the local installation directory of IntelliJ idea, find the following two files, open them with Notepad, and add them on the last line- Dfile.encoding=UTF -8. After the restart, run the program to check the console information, the problem is solved!

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

5、 Code modified successfully

Through the above four ways, we can completely modify the Chinese garbled problem we encountered in IntelliJ idea console.

Four ways to solve the problem of Chinese garbled code in IntelliJ idea console

summary

In this paper, I summarize four methods to solve the problem of Chinese garbled code in IntelliJ idea console perfectly. Once again, after each modification, be sure to restart IntelliJ idea to make the configuration take effect. Good tools to use!

This article is a summary of four ways to solve the problem of Chinese garbled code on IntelliJ idea console in Huawei cloud community, written by Bai Lu.

Click follow to learn about Huawei’s new cloud technology for the first time~

Recommended Today

Hot! Front and rear learning routes of GitHub target 144K

Hello, Sifu’s little friend. I’m silent Wang Er. Last week, while appreciating teacher Ruan Yifeng’s science and technology weekly, I found a powerful learning route, which has been marked with 144K on GitHub. It’s very popular. It covers not only the front-end and back-end learning routes, but also the operation and maintenance learning routes. As […]