乱码场景

使用IntelliJ IDEA经常遇到乱码问题,可以总结为以下几类乱码的场景。

1、工程代码乱码。

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

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

解决方案

1、工程代码乱码

Settings > Editor > File Encodings > Global Encodings & Project Encodings 设置为:UTF-8

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

Settings > Build, Execution, Deployment > Compile > Java Compiler > Additional command line parameters > 设置为:-encoding utf-8

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

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注