Double encoded utf8 characters

Discussions

Web tier: servlets, JSP, Web frameworks: Double encoded utf8 characters

  1. Double encoded utf8 characters (3 messages)

    I am using mysql 4.1.15, tomcat5 and struts 1.2.8 and have the following problem:

    -the jsp pages are all coded utf8 and declared so via page tag.
    -the browser shows that display is utf8 and data is displayed correctly (german umlauts).
    -now, then I submit a form these strings are sent to the server as utf8, but [insert guilty app here] encodes them again as utf8, resulting in a string that looks good if I convert it from utf8 to iso8859-1.
    "Müller" is encoded as "Müller" (which looks like if it is displayed with browser setting = iso8859-1, but it is utf8)

    Any suggestions to solve this problem?

    Threaded Messages (3)

  2. Double encoded utf8 characters[ Go to top ]

    I solved it by adding a servlet filter, which calls request.setCharacterEncoding("UTF-8").
  3. Double encoded utf8 characters[ Go to top ]

    I solved it by adding a servlet filter, which calls request.setCharacterEncoding("UTF-8").

    See here for why it's important to use a filter http://www.jiploo.com/blog/2006/02/struts-utf-8-and-form-submissions.html
  4. See for example Encoding filter in JSOS:
    http://www.servletsuite.com/servlets.htm