天天看點

基于Intellij Idea亂碼的解決方法

使用Intellij Idea經常遇到的三種亂碼問題:

1、工程代碼亂碼

2、main方法運作,控制台亂碼

3、tomcat運作,控制台亂碼

解決方案:

1.工程代碼亂碼

Settings > Editor > File Encodings > Global Encodings & Project Encodings 設定為:

UTF-8

基于Intellij Idea亂碼的解決方法

2.main方法運作,控制台亂碼

Settings > Build, Execution, Deployment > Compiler > Java Compiler > Additional command line parameters > 設定為:

-encoding utf-8

基于Intellij Idea亂碼的解決方法

3.tomcat運作,控制台亂碼

 Edit Configurations > Tomcat Server > server > VM options > 設定為:

-Dfile.encoding=UTF-8

idea > bin > idea.exe.vmoptions或者idea64.exe.vmoptions 配置檔案末尾添加:

-Dfile.encoding=UTF-8