Pagename encoding in URLs broken for UTF-8, was: Re: More on encoding

Malte Kiesel <[email protected]> Fri, 31 Aug 2007 14:21:01 +0200
Newsgroups gmane.comp.java.jspwiki.user
Organization DFKI GmbH
Message-ID <[email protected]>
Janne Jalkanen wrote:

>> But, you know, I think I 've really nailed it this time! :O)
>> The DefaultURLConstructor decodes the request.getPathInfo() under the 
>> assumption that it is ISO-8859-1. Well, it shouldn't, because 
>> everything around it is UTF-8.

This seems to depend on webserver configuration. By default, Tomcat 5.5 
uses ISO-8859-1 as URI encoding [1].

[1] http://tomcat.apache.org/tomcat-5.5-doc/config/http.html
     "URIEncoding"

> Okay!  Now this seems to be a valid fix... It seems that after we 
> started to use HttpServletRequest.setCharacterEncoding() I forgot to 
> update this...

I think this is unrelated. JavaDoc for that method says "Overrides the 
name of the character encoding used in the body of this request." - body 
only (that is, unless useBodyEncodingForURI is set to true which it 
isn't by default at least in Tomcat 5.5).

For me, JSPWiki was broken until I set added the attribute 
URIEncoding="UTF-8" to the connector in server.xml.

BTW the dead code in DefaultURLConstructor is quite confusing. I'd 
recommend to add explaining comments for code that got commented out or 
delete it altogether.

> Did you BTW have jspwiki.encoding=UTF-8 in your jspwiki.properties?

Yes.

Regards