IDEA 控制台日志中文乱码解决方案

1.修改IDEA安装目录下的idea64.exe.vmoptions

IDEA快捷方式右键->属性->打开文件所有位置,找到idea的安装位置下的idea64.exe.vmoptions文件,再最后一行添加

-Dfile.encoding=UTF-8

 

2.设置IDEA编码格式

依次打开file->setting->editor->file encoding,下图所示位置均选为UTF-8

 

3.在IDEA里修改idea64.exe.vmoptions

菜单Help -> Edit Custom VM Options,在末尾增加如下代码

-Dfile.encoding=UTF-8

4.配置tomcat运行编码

(1)修改catalina.bat(好用!!!)

Tomcat安装目录下的bin目录中,对catalina.bat进行如下配置,大概在220行左右,修改如下代码。

在双引号内增加 -Dfile.encoding=UTF-8

 (2)在 Server > VM options 设置为 -Dfile.encoding=UTF-8 ,重启tomcat

 

5.修改控制台默认编码

依次打开File -> setting -> editor -> General -> Console,下图所示位置选为UTF-8,

 

以上设置都需要重启软件生效!!

6.Tomcat运行项目,中文日志不乱码,System.out中文乱码

解决方法:

在发布项目的Tomcat配置的【虚拟机选项】处填写   -Dfile.encoding=UTF-8

 

posted @ 2023-03-05 16:33  熊猫Panda先生  阅读(2890)  评论(0编辑  收藏  举报