Reference address: http://www.cnblogs.com/vhua/p/idea_1.html?utm_source=tuicool&utm_medium=referral
Recently, the IDE has been changed from eclipse to IntelliJ IDEA. The reason is that most people in the company are using this IDE and have always recommended it, so try it out. On the first day of the change, I encountered the garbled problem that any IDE will encounter, and it took a lot of time to finally solve it, so I record the solution here for later reference.
There are a total of the following garbled solutions:
Engineering garbled
When executing the main function, the console is garbled
When running tomcat, the console is garbled
PS: If the following scheme does not take effect , open the IDEA installation directory to find the idea.exe.vmoptions ( idea64.exe.vmoptions for 64-bit ) file, and add -Dfile.encoding=UTF-8 at the end of the file
You can do this step first, plus this basically a lot of them will not be garbled
1. Engineering garbled code
Open File-Setting, find the option File Encodings, set the encoding to the encoding of your project, usually UTF-8, as shown in the figure below (the place in the red box), and then rebuild it, basically it will do
2. When executing the main function, the console is garbled
The same is to open the setting, find Build, Execution, Deployment > Compiler > Java Compiler, set the Additional command line parameters option to -encoding utf-8, then rebuild and re-run
3. When running tomcat, the console is garbled
1) Open Run/Debug Configuration, select your tomcat
2) Then set -Dfile.encoding=UTF-8 in Server > VM options and restart tomcat
Author: wvqusrtg
Link: https://www.jianshu.com/p/42beea9f6e5c
Source: Jianshu The
copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.