Quantcast
Channel: techscouting through the java news » Encoding
Viewing all articles
Browse latest Browse all 3

Solving Tomcat Encoding Problems in UTF-8 Webapps

$
0
0

The default configuration of Apache Tomcat 6 can cause encoding problems with URLs (links) that contain umlauts.

In a Grails project we had the case that html links didn’t work. The problem was that the URL contained parameters with umlauts.

The url wasn’t encoded as UTF-8, so the browser (Mozilla Firefox 3.5) couldn’t handle the url correctly.

To fix the problem in Tomcat 6, you have to edit the file server.xml.
Change the connector entry and add a URIEncoding attribute.

Replace the following line

<connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>

with this line

<connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>

You can find an explanation of the URIEncoding attribute in the Tomcat documentation:

URIEncoding: This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used.


Viewing all articles
Browse latest Browse all 3

Trending Articles