The code scenario
Intellij Idea often encounters garbled code problems, which can be summarized as the following types of garbled code scenarios.
1. Engineering code is garbled.
2, main method run, console garbled.
3, Tomcat running, console garbled.
The solution
1. Engineering code is garbled
Settings > Editor > File Encodings > Global Encodings & Project Encodings Set to utF-8.
2, main method run, console garbled
Settings > Build, Execution, Deployment > Compile > Java Compiler > Additional Command Line Parameters > – encoding to utf-8.
3, Tomcat running, console garbled
Edit Configurations > Tomcat Server > Server > VM Options > Set it to: -dfile. encoding=UTF-8.
Idea > bin > idea.exe.vmoptions or idea64.exe.vmoptions Add -dfile. encoding=UTF-8 to the end of the configuration file.
Follow the wechat official account of Java technology stack and reply to the keyword: IDEA in the background to obtain more IDEA technical articles.