I'm having trouble with special characters in my Tomcat projects. I have all of my files in UTF-8 with meta set for UTF-8 and still when I write łóęążźć
in any form and send it by POST/GET method (I'm doing it by ajax with jQuery) I got something much more like: [|zB�D
.
How can I fix it? I'm pretty sure it's because of Tomcat (I'm using 6.0 version).
Note that jquery's ajax() function will always transmit data with UTF-8 encoding.
In Tomcat, it's best to set the uRIEncoding
option of the connector to UTF-8
(in server.xml). This is mainly for the encoding of the URLs but it seems to affect the encoding used with POST request (url encoded) as well:
<Connector
port="8080"
redirectPort="8443"
uRIEncoding="UTF-8"
maxThreads="100">