##idea中文乱码终极解决方案
idea最蛋疼的地方就是乱码问题了,以前浪费了挺多时间在上面,所以总结一下,以后也好翻阅!
###1.解决代码中乱码
- 主界面,右下角选择编码为utf-8
- ctrl+alt+s 打开setting,搜索file encodings,设置Global encoding/project encoding/properties files三个位置都设为utf-8(最好吧中间的项目名称后面的Encoding也修改为utf-8)
###2.解决控制台乱码
- edit configurations->tomcat->VM options后面填-Dfile.encoding=UTF-8;
- edit configurations->tomcat选择startup/Connection,选择Run,点击下面的加号填
JAVA_OPTS -Dfile.encoding=UTF-8
和JAVA_TOOL_OPTIONS -Dfile.encoding=UTF-8
,选择Debug,再操作一遍
- 找到idea按照目录C:\Users\yourcomputername.IntelliJIdea2017.1文件下,修改idea.exe.vmoptions文件,在最后一句添加
-Dfile.encoding=UTF-8
;IntelliJ IDEA 171.3780.15\bin目录下文件idea64.exe.vmoptions和idea.exe.vmoptions同样在最后一句添加-Dfile.encoding=UTF-8
- ctrl+alt+s 打开setting,搜索Java Compiler,在最后一行的Additional command line parameters加-encoding utf-8
以上,通常可解决所遇到的所有乱码问题!如果还是不能解决,那就换电脑吧…逃