| Title | Messing chinese wiki page name |
| Date | 09-Feb-2006 06:40:11 EET |
| Version | 2.3.76 |
| Submitter | 210.200.105.217 |
| Bug criticality | BadBug |
| Browser version | IE, Firefox |
| Bug status | ClosedBug |
| PageProvider used | |
| Servlet Container | Tomcat 5.5 |
| Operating System | Windows XP |
| URL | |
| Java version | Java Tiger |
Using DefaultURLConstructor as default url constructor, JSPWiki would mess if the wiki page name is in chinese.
I checked out the implementation of DefaultURLConstructor.parsePage() method:
public String parsePage( String context,
HttpServletRequest request,
String encoding )
throws UnsupportedEncodingException
{
request.setCharacterEncoding( encoding );
String pagereq = request.getParameter( "page" );
if( context.equals(WikiContext.ATTACH) )
{
pagereq = parsePageFromURL( request, encoding );
}
return pagereq;
}
request.setCharacterEncoding( encoding ); seems invalid, the value of pagereq is still encoded in ISO8859-1. When writing out to broswer, we got a messing result. (Of course, my jspwiki.encoding = UTF-8)
My patch is following:
String pagereq = request.getParameter( "page" );
if(pagereq != null)
pagereq = TextUtil.urlDecode( pagereq, encoding );
if( context.equals(WikiContext.ATTACH) )
{
pagereq = parsePageFromURL( request, encoding );
}
return pagereq;
BTW, www.jspwiki.org is ok because it uses ShortViewURLConstructor. The encoding problem is resolved by WikiServlet.
Fixed in 2.4.x. Please also check the TomcatAndUTF8 page.