properties的编码问题

Posted Deolin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了properties的编码问题相关的知识,希望对你有一定的参考价值。

1、在eclipse中,如果不专门设置,properties文件的编码是ISO-8859-1,最好将其改为UTF-8

 

2、当properties文件的编码改为UTF-8还不够,Spring的context:property-placeholder标签也是用ISO-8859-1编码的方式引入properties文件的,所以需要在标签里追加一个file-encoding属性

<context:property-placeholder location="classpath:copywriting.properties"
        file-encoding="utf-8" ignore-unresolvable="true" />

 

以上是关于properties的编码问题的主要内容,如果未能解决你的问题,请参考以下文章