1、工程代码乱码。

2、main方法运行,控制台乱码。

3、tomcat运行,控制台乱码。

解决方案

1、工程代码乱码

Settings > Editor > File Encodings > Global Encodings & Project Encodings 设置为:UTF-8。然后rebuild下,重新运行

       idea 乱码问题
2、main方法运行,控制台乱码

Settings > Build, Execution, Deployment > Compiler > Java Compiler > Additional command line parameters > 设置为:-encoding utf-8 然后rebuild下,重新运行

      idea 乱码问题
3、tomcat运行,控制台乱码

Edit Configurations > Tomcat Server > server > VM options > 设置为:-Dfile.encoding=UTF-8 重启tomcat

PS: 如果上面方案不生效时,打开IDEA安装目录找到


idea > bin > idea.exe.vmoptions或者idea64.exe.vmoptions 配置文件末尾添加:-Dfile.encoding=UTF-8

idea 乱码问题


相关文章:

  • 2021-10-30
  • 2021-07-02
  • 2021-12-08
  • 2021-07-26
  • 2021-05-09
  • 2021-12-03
  • 2021-04-30
  • 2021-09-04
猜你喜欢
  • 2021-10-06
  • 2021-06-25
  • 2021-05-18
  • 2021-04-10
相关资源
相似解决方案