POST parameters using wrong encoding in JSF 1.2

后端 未结 3 1606
抹茶落季
抹茶落季 2021-01-13 16:46

I\'m having a problem with charset encoding in my web application (JSF 1.2, Spring and Tomcat 7), and I\'ve ran out of ideas of what to test to see where it is going wrong.<

3条回答
  •  醉梦人生
    2021-01-13 17:26

    The symptoms indicate that the browser has sent the data using ISO-8859-1 encoding instead of UTF-8. This in turn means that the HTTP response Content-Type header is not been set with the proper charset attribute. In for example Firebug, you can find it out as follows:

    enter image description here

    You're right that Facelets uses UTF-8 by default. But very early versions of Facelets weren't programmed to use UTF-8 by default. See also among others issue 46 and issue 53. Facelets is currently at 1.1.15.B1.

    As to your attempts to fix it, the presence of the XML prolog is not strictly necessary and its encoding isn't used in any way to set the response encoding, it's only used by the XML parser to decode the inputstream to characters. Spring's filter is also not necessary, but that it didn't solve the problem after you added it is enough evidence that it's the client who has sent the data as ISO-8859-1.

提交回复
热议问题