Character-encoding problem spring

前端 未结 3 1815
春和景丽
春和景丽 2020-12-30 06:26

I am stuck in a big problem with encoding in my website! I use spring 3, tomcat 6, and mysql db. I want to support German and Czech along with English in my website, I creat

3条回答
  •  鱼传尺愫
    2020-12-30 06:35

    First, if your project is using Maven, make sure that the Maven Resources Plugin has UTF-8 set as its character encoding scheme, otherwise the message properties files could be written to your target with an incorrect encoding.

    Second, you're using ResourceBundleMessageSource, which uses the standard java.util.ResourceBundle and java.util.Properties, which only support ISO-8859-1 encoding. You can instead use ReloadableResourceBundleMessageSource like:

    
             
             
    
    

    which I discovered from this Cake Solutions blog post.

提交回复
热议问题