TitleURLEncoder encode problem on ISO-8859-1
Date18-Feb-2005 11:41:02 EET
Version2.1.148
Submitter195.85.222.72
Bug criticalityBadBug
Browser versionIE
Bug statusClosedBug
PageProvider usedRCSFileProvider
Servlet Containertomcat 5.0.28 inside og jboss 4.0.1RC2
Operating SystemLinux 2.6.8
URLall pages with image attachments
Java version1.4.2_05

Hi,

e.g. the imagelink for the outlink image is escaped as src="images%2Fout.png". Therefore the browser can found it.

The problem is in class WikiEngine:

 public String encodeName( String pagename ) {
        try {
            if( m_useUTF8 )
                return TextUtil.urlEncodeUTF8( pagename );
            else
                return java.net.URLEncoder.encode( pagename, "ISO-8859-1" );
        }
If I doesn't have setup my wiki to use UTF8, it uses the default URLEncoder which encodes the pagename "images/out.png" to "images%2Fout.png". This passes also all embedded images

Switching my wiki to jspwiki.encoding=UTF8 solves the problem, but that's not really a solution.

-- SteffenStundzig

Hi,

To change the encoding to UTF-8, I must rename all files and attachment directories in the page repository. To leave it as is, I've added a simple workaround for the URLEncoder encoding:

            	String ret = java.net.URLEncoder.encode( pagename, "ISO-8859-1" );
            	// TODO: WORKAROUND
            	ret = ret.replaceAll("%2F","/");
            	return ret;

But now I've another problem. BasicAttachmentProvider and some other classes uses the TextUtil.encodeUTF8 directly, instead of checking if the page encoding is another one. So the link to the attachment is e.g. encoded as ISO-8859-1, but the attachment provider knows only UTF-8. Therefore I can't found the attachments, they I created above, if the page contains german umlauts.

-- SteffenStundzig

I've replaced all occurences of TextUtil.encodeUTF8 with m_engine.encodeName, but now I've strange error on BasicAttachment.listAttachments.

To be continued...


Oof. I guess this just means I have to write my own URLEncoder even for Latin1...

-- JanneJalkanen


This should now be fixed in 2.1.152. Please reopen, if it still does not work.

-- JanneJalkanen

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-8) was last changed on 26-Feb-2005 21:01 by Administrator