Kees de Kooter
23-02-2009, 11:13
I have been struggling with (url) encoding issues for quite some time. The customer needed to have literal strings in REST-style urls. The default encoding on his platform (Windoze) worked well until they wanted to add words in east european languages, like s-es with funny hats.
On my linux box everything worked well after setting the encoding to UTF-8 in the most obvious places. On the customer's target platform however things were messed up.
After ruling out both IIS and the ISAPI redirector I finally solved it by adding a Filter with the following line:
servletRequest.setCharacterEncoding("UTF-8");
The REST-style URLs are now interpreted properly.
However the app also contains old fashioned urls. One problem remained: encoded strings in request parameters (i.e. after the "?"). The funny thing is that POST requests work fine, GETs mess up.
This time tomcat is to blame. Atlassian to the rescue:
http://confluence.atlassian.com/display/DOC/Configuring+Tomcat%27s+URI+encoding
Apparently tomcat defaults to ISO-8859-1. I added URIEncoding="UTF-8" to the HTTP and AJP connectors and now it is working fine.
On my linux box everything worked well after setting the encoding to UTF-8 in the most obvious places. On the customer's target platform however things were messed up.
After ruling out both IIS and the ISAPI redirector I finally solved it by adding a Filter with the following line:
servletRequest.setCharacterEncoding("UTF-8");
The REST-style URLs are now interpreted properly.
However the app also contains old fashioned urls. One problem remained: encoded strings in request parameters (i.e. after the "?"). The funny thing is that POST requests work fine, GETs mess up.
This time tomcat is to blame. Atlassian to the rescue:
http://confluence.atlassian.com/display/DOC/Configuring+Tomcat%27s+URI+encoding
Apparently tomcat defaults to ISO-8859-1. I added URIEncoding="UTF-8" to the HTTP and AJP connectors and now it is working fine.