Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1049

Character encoding of GET request parameter

$
0
0

Hello fellow Stackoverflowers.

I have an issue that i need some help with:

We're making an http GET web service call from a smartphone app to a Java/Spring MVC application. We're on a Tomcat application server that is fronted by an Apache server with a mod_proxy proxy setup.

One of the parameters imbedded in the URL is the word "Männen", which is the organization name that's one of the parameters. The app makes a Jquery Ajax GET request and the parameter leaves the app as "M%E4nnen", which to my understanding means the "ä" has been properly URL-encoded. When it arrives to the Spring controller, it has been distorted to "Männen".

I have googled and found quite a few threads on this and they all recommend modifying the Tomcat server.xml file by adding URIEncoding="UTF-8" to all connectors. Of course, i tried this. It made a change but did not solve the issue. The string now comes through as "M�nnen". There was also a thread suggesting you add "nocanon" to the ProxyPass parameter in the Apache proxy configuration. This was tried but made no difference.

Using the logs, i can follow the request:

  1. In the Apache access log, the parameter is logged as "M%E4nnen"
  2. In the Apache proxy log, the parameter is logged as "M%E4nnen"
  3. In the Tomcat localhost_access log, the parameter is logged as "M%E4nnen"
  4. In the Spring controller that receives the request, the parameter is logged as "M�nnen"

My Spring application also has a character encoding filter, but as far as i understand, it only works on the request body. It is configured as shown below:

<filter><filter-name>CharacterEncodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>CharacterEncodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>

I really don't know what else to try or where else to look. If anyone could guide me in the right direction, it would be highly appreciated.


Viewing all articles
Browse latest Browse all 1049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>