struts 2 国际化乱码问题解决方案

所有的文件编码都设置为utf-8。所有过程正常开发结束后。将messagesource.propertis本地化:
native2ascii messagesource.propertis messagesource_zh_CN.propertis
运行,发现页面上从资源文件中读取的内容仍然为乱码。解决方法一:本地化时指定编码方式即可,如下:

native2ascii -encoding UTF-8 messagesource.propertis messagesource_zh_CN.propertis

解决方法二:用站长工具将简体中文转化为unicode即可

 在转化为unicode编码后,将编码复制到对应的配置的文件的值去,以便解析。

猜你喜欢

转载自blog.csdn.net/zuoyouzouzou/article/details/87817544
今日推荐