Detect the URI encoding automatically in Tomcat
Posted
by Roland Illig
on Stack Overflow
See other posts from Stack Overflow
or by Roland Illig
Published on 2010-04-17T06:34:32Z
Indexed on
2010/04/17
6:43 UTC
Read the original article
Hit count: 399
I have an instance of Apache Tomcat 6.x running, and I want it to interpret the character set of incoming URLs a little more intelligent than the default behavior. In particular, I want to achieve the following mapping:
So%DFe => Soße
So%C3%9Fe => Soße
So%DF%C3%9F => (error)
The bevavior I want could be described as "try to decode the byte stream as UTF-8, and if it doesn't work assume ISO-8859-1".
Simply using the URIEncoding
configuration doesn't work in that case. So how can I configure Tomcat to encode the request the way I want?
I might have to write a Filter that takes the request (especially the query string) and re-encodes it into the parameters. Would that be the natural way?
© Stack Overflow or respective owner