简体   繁体   中英

Tomcat restart or redeploy breaks unicode characters from java source files

I have developed a liferay 6.2 application using jsf and primefaces 4. I have unicode characters both in xhtml files and java source files. There a strange behaviour of breaking my characters after tomcat restart or redeploy of application and the problem is only with characters coming from the source files. The rest unicode characters on the page are displayed correctly. And the behaviour is not always reproducible.

I have read posts referring to setting the jvm's or tomcat default encoding and main suggested action was setting -Dfile.encoding=UTF-8 but didn't have any luck. I am using tomcat 7.0.42

If you are using Eclipse, try setting the text encoding in your project Properties>Resource

在此处输入图片说明

The problem has to do with the encoding of the class files. The solution was to set the correct encoding for javac. I finally discovered that in eclipse I had to edit the build. user .properties file to set javac.encoding = UTF-8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM