解决方法一:
1.打开tomcat配置页面,Edit Configurations。
2.在配置项VM options文本框中输入-Dfile.encoding=UTF-8,
添加一条JAVA_TOOL_OPTIONS,
点击Apply,OK即可。
3.尝试重启Tomcat。
解决方法二:
1.打开idea本地安装目录中bin文件夹下的
idea.exe.vmoptions和
idea64.exe.vmoptions这两个文件。
2.分别在这两个文件内容的末尾添加-Dfile.encoding=UTF-8。
3.点击File–>Settings–>Editor>File Encodings,
将三处设置成UTF-8,
点击Apply,OK。
4.重启idea。
解决方法三:
1.修改idea的vmoptions文件,
点击Help–>Edit Custom VM Options,
在文本末尾加上:
-Dfile.encoding=UTF-8
-Dconsole.encoding=UTF-8
2.修改Tomcat的默认编码,
打开Tomcat安装目录下conf/service.xml文件,
给Connector节点加上配置URIEncoding=“UTF-8”,如下图所示。
3.重启idea。