The IDE has recently changed from eclipse to IntelliJ idea because most of the company is using the IDE, and it's always recommended, so try it fresh. For the first day, I met the IDE will encounter the garbled problem, took a lot of time to finally solve, so here to record a solution for later reference.
There are a total of the following garbled solutions:
- Project garbled
- The console is garbled when executing the main function
- The console is garbled when running Tomcat
PS: If the following scenario does not take effect , open the idea installation directory to find the idea.exe.vmoptions(64-bit idea64.exe.vmoptions) file, and at the end of the file, add -dfile.encoding=utf-8
Can do this first step, plus this basically a lot of is not garbled
1. Project garbled
Open file-setting, find the File encodings this option, the encoding set to your project code can be, generally UTF-8, such as (red Box place), and then rebuild again, basic on the line
2. The console is garbled when executing the main function
Also open setting, find Build,execution,deployment > Compiler > Java Compiler, set Additional command line parameters option for-enc Oding Utf-8, then rebuild down, rerun
3. The console is garbled when running Tomcat
1) Open Run/debug Configuration and choose your tomcat
2) then in Server > VM options set to-dfile.encoding=utf-8, restart Tomcat
OK, three kinds of solution garbled solution is probably the case, there are questions to leave a message
IntelliJ Idea garbled solution (project code, console, etc.)