UTF-8 character encoding problems for International language in EAP
Issue
Configuring "text/html; charset=utf-8" in JSP, URI query is expected to be encoded/decoded by UTF-8. Looks URI query is encoded by UTF-8 well but it is decoded by "ISO-8859-1
". Hence, the characters are broken.
For example:
On Request JSP page
, submit these 2 parameter with GET method:
test=8m² , test2=Cédric
==> URL : test=8m%c2%b2&test2=C%c3%a9dric&chosenmenu=1 (This URL is correctly encoded (UTF-8 characters escaped for URL))
On Response JSP page
(using JSP EL standard syntax), print the parameters:
test=8m² , test2=Cédric
==> These characters are decoded by ISO-8859-1 encoded
When the system property "org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING=true
" is added on the JVM, the results are correct as expected: the page encoding is used to decode the URI.
Why the page encoding is not used by default for URI decoding ?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5.x
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.