简体   繁体   中英

Spring/Tomcat not honoring UTF-8 encoding?

My web application (Java/Tomcat/Spring/Maven) is having trouble dealing with special characters like ' (hex 92, decimal 146). This comes into my app as another weird character.

I have looked at this question and verified that II have the following line in all my JSP files:

<%@ page contentType="text/html; charset=UTF-8" %>

I also looked at this question and verified that I have the following line in my Maven pom.xml:

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

So as far as I can tell everything should be built and handled in UTF-8. But when I submit the string Martin's Auto Repair what shows up at the server during the Spring binding process is Martinâ\€\™s Auto Repair . This is the string that gets handed back by Tomcat to my application.

Worse, this is echoed back to the browser so submitting the altered string again expands the weird characters over and over.

Any suggestions? At this point I'm not sure if this is a browser problem or a server problem.

Hex 92 is not a character in Unicode ( http://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF )

Windows codepage 1252 is not 100% identical to Unicode.

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