tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: ServletWebRequest.getServletPath() returns strange values on uris with german umlauts
Date Thu, 27 Jan 2011 10:06:00 GMT
asbachb wrote:
> Thank you for you reply.
> Sorry for expressing me a little vague. I meant that i alread tried both
> attributes. 
> My used encoding is UTF-8.
> Here are the missing sources:
> Konstantin Kolinko wrote:
>> 2011/1/27 asbachb <>:
>>> Like mentioned in the CharacterEncoding FAQs I already setup URIEncoding
>>> and
>>> useBodyEncodingForURI attribute in my server.xml configuration.
>> URIEncoding and useBodyEncodingForURI  are alternatives. Do not use
>> both at the same time.  My understanding of /docs/config/http.html is
>> that useBodyEncodingForURI overrides URIEncoding. So, what is your
>> "body encoding" in this case?
Maybe the first thing to remember is this :
Section : 2.1 URI and non-ASCII characters

In other words : a URI /does not/ have any specific encoding, nor is there any way in the

HTTP protocol of specifying one.
So, whatever you do in terms of interpreting this URI, depends on an agreement between the

client and the server.
/If/ you can be sure that all the cients accessing your application will always encode the

URI of their request using charset/encoding XYZ, /then/ you can decide to decode this URI

at the server side using the same charset/encoding.
And otherwise, well, you have a problem.
And within the limitations of the current HTTP protocol, that problem cannot be solved 

In other words also, the Tomcat attributes useBodyEncodingForURI and URIEncoding are a way

for you to influence how the server side will decode the URI's, but they cannot do 
anything about how the clients are encoding them.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message