In my case, the problem arose when I was trying to load a jqGrid base table. The user fills some fields inside a form and when she presses the search button, a jqGrid is created and a request is sent to a Spring MVC Controller.
$("#myGrid").jqGrid({ url: '/myapp/mypage/search?+ $('#myForm').serialize(), loadonce:true, mtype: 'GET', datatype: "json", (...) });
When some field inside "myForm" has special characters, for example 'áéíóú', the URL generated will be as follows:
http://localhost:8080/myapp/mypage/search?descripcion=%C3%A1%C3%A9%C3%AD%C3%B3%C3%BA&_search=false&nd=1477817915534&rows=20&page=1&sidx=&sord=ascThese values are the result of converting the input text to UTF-8. Inside the controller you would see ANSI characters but the application is expecting UTF-8.
The solution is to configure URI encoding in JBoss EAP 6.2 connector using the following standalone.xml configuration:
<system-properties> <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/> <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/> </system-properties>
In domain mode you can configure these properties at server level or server group level.
There are more useful JBoss properties I collected in a previous post: http://trabajosdesisifo.blogspot.com.es/2015/12/jboss-useful-system-properties.html
Anyway, if you are working with UTF-8, don't forget the the Spring CharacterEncodingFilter.
No hay comentarios:
Publicar un comentario