List Info

Thread: Problem: international characters in attachments




Problem: international characters in attachments
user name
2006-10-16 19:57:15
Hello,
I had a problem with attachments that contain international
characters.

I debugged a bit and found out that on request the page name
is 
extracted from the page parameter. Since there is 
request.setCharacterEncoding called prior to that, the
international 
utf-8 page names are extracted fine.

This doesn't apply to the attachments though, since their
names are not 
extracted this way. request.getPathInfo is called instead.
But setCharacterEncoding doesn't influence the encoding
getPathInfo 
returns. It has to be manually encoded.

To fix, the DefaultUrlConstructor.parsePageFromURL(
HttpServletRequest 
request, String encoding ) method has to be extended the
following way:

String name = request.getPathInfo();

// insert begin
if ("UTF-8".equals(encoding)) {
     byte[] buf = name.getBytes("ISO-8859-1");
     name = new String(buf, "UTF-8");
}
// insert end

if( name == null || name.length() <= 1 )
...

Janne, could you please update?

Best regards
Rafal
_______________________________________________
Jspwiki-users mailing list
Jspwiki-usersecyrd.com
http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users
Problem: international characters in attachments
user name
2006-10-17 18:43:58
> This doesn't apply to the attachments though, since
their names are  
> not extracted this way. request.getPathInfo is called
instead.
> But setCharacterEncoding doesn't influence the encoding
getPathInfo  
> returns. It has to be manually encoded.

Hm.  According to the Javadoc, setCharacterEncoding()
*should*  
influence getPathInfo() calls.  Which servlet container are
you using?

/Janne
_______________________________________________
Jspwiki-users mailing list
Jspwiki-usersecyrd.com
http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users
Problem: international characters in attachments
user name
2006-10-18 19:09:06
Janne Jalkanen wrote:
>> This doesn't apply to the attachments though, since
their names are 
>> not extracted this way. request.getPathInfo is
called instead.
>> But setCharacterEncoding doesn't influence the
encoding getPathInfo 
>> returns. It has to be manually encoded.
>
> Hm.  According to the Javadoc, setCharacterEncoding()
*should* 
> influence getPathInfo() calls.  Which servlet container
are you using?

Tomcat 5.5.17

-- 
Regards
Rafal

_______________________________________________
Jspwiki-users mailing list
Jspwiki-usersecyrd.com
http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )