使用下面语句查看编码:

String encoding = System.getProperty("file.encoding");
结果输出:ANSI_X3.4-1968,从而导致中文乱码
通过 locale 查看服务器系统编码,需要修改:
1在tomcat启动脚本里加入  -Dfile.encoding=UTF-8 选项
2修改配置文件,使得如下环境变量为这样的值:

 LANG="en_US.UTF-8"
 LC_ALL="en_US.UTF-8"

可使用locale 命令测试。

最后重启服务器,即可。

参考自:https://confluence.atlassian.com/confkb/filesystem-encoding-is-written-as-ansi_x3-4-1968-even-though-the-server-is-set-to-utf-8-658735809.html

相关文章:

  • 2021-09-11
  • 2021-11-11
  • 2022-02-10
  • 2022-12-23
  • 2021-05-10
  • 2022-01-06
  • 2021-06-23
  • 2021-08-05
猜你喜欢
  • 2022-12-23
  • 2022-01-14
  • 2021-12-03
  • 2022-12-23
  • 2021-07-26
  • 2021-12-02
  • 2021-08-12
相关资源
相似解决方案