关于idea下中文乱码(该问题较偏)的解决 Multiple encodings set for module chunk platf "GBK" will be used by compile

Information:java: Multiple encodings set for module chunk platf "GBK" will be used by compile

环境:tomcat8+jdk8+window7 64位 + ssm框架(最基本)+idea编辑器

个人配置:均为utf-8。

问题:java文件中使用中文如

String s1 = "当前在线人数:";
String s2 = "人";
sb.append(s1).append(num).append(s2);

接口使用@ResponseBody @RequestMapping中指定

produces = "text/html;charset=UTF-8")  
 
 

springMvc中设置了中文utf-8编码

但是无论如何浏览器接受响应的中文都是乱码 如下图:


并且response Header中

Content-Type:
text/html;charset=UTF-8。

以上种种迹象表明,各单位的配置绝对没问题!!!!

一天后。。。。

解决:在编译时看到了一句话Information:java: Multiple encodings set for module chunk platf "GBK" will be used by compile。

我就怀疑是编译时使用了gbk编码编译,找到工程下.idea目录中的encodings.xml,果不其然,如下图:


确实使用了gbk编码去编译,我将改文件改为下图


然后重新clean打包发布后 乱码解决。

总结:这个问题从来没遇到过,以后算是知道怎么弄了;

猜你喜欢

转载自blog.csdn.net/qq_33353322/article/details/80285434
今日推荐