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" />

 

posted @ 2017-10-16 13:51  Deolin  阅读(1150)  评论(0编辑  收藏  举报