[jboss-jira] [JBoss JIRA] (WFLY-8358) Wrong charset received in HttpServletRequest sent by POST method with JQUERY AJAX

Mario García García (JIRA) issues at jboss.org
Wed Mar 22 07:48:00 EDT 2017


     [ https://issues.jboss.org/browse/WFLY-8358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mario García García updated WFLY-8358:
--------------------------------------
    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


  was:
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 no 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




> Wrong charset received in HttpServletRequest sent by POST method with JQUERY AJAX
> ---------------------------------------------------------------------------------
>
>                 Key: WFLY-8358
>                 URL: https://issues.jboss.org/browse/WFLY-8358
>             Project: WildFly
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 10.1.0.Final
>         Environment: Tested in Windows 7 Enterprise and tested in Linux 3.16.6-2-desktop
>            Reporter: Mario García García
>            Assignee: Jason Greene
>         Attachments: MiServlet.java, index.jsp
>
>
> 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



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)



More information about the jboss-jira mailing list