Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-8358

Wrong charset received in HttpServletRequest sent by POST method with JQUERY AJAX

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 10.1.0.Final
    • Web (Undertow)
    • None
    • User Experience

    Description

      Performing a typical AJAX call with JQUERY ($.ajax function) to a Servlet from a JSP with method POST and sending a parameter that contains a String with latin characters such as 'ó'.
      This is the String that is sent into a parameter:
      "Código"

      No content type specified so JQUERY.AJAX takes the default one (contentType: 'application/x-www-form-urlencoded, charset=UTF-8').

      The received parameter in HttpServletRequest (doPost method) is showed like this:
      "C??digo".
      In Hex this is the content:
      43 3f3f 6469676f (spaces added for better reading pourposes)

      This is not UTF-8. The proper encoding should be:
      43 c3b3 6469676f (spaces added for better reading pourposes)

      Wildfly Configuration:

      Subsystems Subsystem: Web/HTTP - Undertow Settings: Servlet/JSP
      Default encoding: (empty)
      Java encoding: UTF8

      Subsystems Subsystem: Web/HTTP - Undertow Settings: HTTP
      Url charset: UTF-8

      Attachments

        1. index.jsp
          0.8 kB
        2. MiServlet.java
          2 kB

        Activity

          People

            flaviarnn Flavia Rainone
            mario2004@gmail.com Mario García (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: