IDEA中使用Tomcat解决中文乱码问题

时间:2021-04-13 12:20:15   收藏:0   阅读:0

IDEA中使用Tomcat解决中文乱码问题

  1. 首先在Tomcat的Configurations中配置VM options:

    -Dfile.encoding=UTF-8
    技术图片

  2. 如果操作1不行,就设置IDEA的编码:

    在Setting中选择File Encodings:

    Global Encoding选择UTF-8;Project Encoding选择UTF-8;Default encoding for properties files选择UTF-8并勾选右侧对勾
    技术图片

  3. 如果之前的方法不奏效,打开IDEA安装目录的/bin子目录

    D:\IDEA\IntelliJ IDEA 2019.1.3\bin

    打开idea.exe.vmoptions和idea64.exe.vmoptions文件(我这里使用的Notepad++,也可以记事本)

    在末尾均添加一行-Dfile.encoding=UTF-8
    技术图片
    保存文件,重启IDEA和Tomcat解决中文乱码问题

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!