Intellij IDEA控制台,项目的web页面的中文乱码解决方案
web页面的中文乱码:
1、tomcat->Edit Configurations
2、选择Startup/Connection,勾选Pass environment variables,选择添加(+),加下面表中的数据
Name | Value |
---|---|
JAVA_TOOL_OPTIONS | -Dfile.encoding=UTF-8 |
JAVA_OPTS | -Dfile.encoding=UTF-8 |
填写完成选择右下方,Apply,OK
3、选择server,在VM options填写: -Dfile.encoding=UTF-8
4、ctrl+F5刷新页面即可
控制台的乱码
1、找到idea按照的路径下的bin中idea.exe.vmoptions和idea64.exe.vmoptions
2、两个文档的最后一行加: -Dfile.encoding=UTF-8。
3、重启idea即可