You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wheleph <wh...@gmail.com> on 2007/10/26 14:55:48 UTC

IE DownloadLink problems

Hello everyone!

I've got a problem using DownloadLink. When a name of a file that is
referenced by DownloadLink contains non-ASCII characters I get "CAC96UV"
instead of "Кириллица.txt" in Internet Explorer download prompt. I  encode
the name in Q-encoding, and this doesn't help. Firefox displays this name
well.

Here's the headers the browser receives:

Date	Fri, 26 Oct 2007 12:43:47 GMT
Content-Length	1406
content-disposition	attachment; filename="=?utf-8?Q?todo.txt?="
Server	Jetty(6.1.5)

Any ideas?

wheleph
-- 
View this message in context: http://www.nabble.com/IE-DownloadLink-problems-tf4697141.html#a13426666
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE DownloadLink problems

Posted by Johan Compagner <jc...@gmail.com>.
please make a case for this in jira. (with that patch)

On 10/29/07, wheleph <wh...@gmail.com> wrote:
>
>
>
> wheleph wrote:
> >
> > Content-Disposition attachment; filename=%D0%A1 ...
> > I wonder what encoding is it?
> >
>
> It's url encoding. I used URLCodec from commons-codec
> (http://commons.apache.org/codec/) package to encode file name for IE but
> for FF I still need Base64 or Q-encoding. That's why I need to detect the
> type of user's browser and send appropriately encoded file name (see the
> snippet below). I think it would be nice improvement for DownloadLink to
> perform the encoding of file name internally.
>
> [code]
>        WebResponse r = (WebResponse) requestCycle.getResponse();
>        WebClientInfo clientInfo = (WebClientInfo)
> requestCycle.getClientInfo();
>        final String userAgent = clientInfo.getUserAgent();
>        logger.info("userAgent: " + userAgent);
>
>        StringEncoder codec = null;
>        if (userAgent.indexOf("MSIE") != -1) {
>                codec = new URLCodec();
>        } else {
>                codec = new BCodec();
>        }
>        final String name = ecoFile.getName();
>        String encodedName = null;
>        try {
>                encodedName = codec.encode(name);
>        } catch (EncoderException e) {
>                encodedName = ecoFile.getName();
>                final String message = "Error while encoding name " + name
> + " with codec
> " + codec;                                      logger.warn(message, e);
>        }
>        r.setAttachmentHeader(encodedName);
>
>        // copy byte stream from file to response...
> [/code]
>
> wheleph
> --
> View this message in context:
> http://www.nabble.com/IE-DownloadLink-problems-tf4697141.html#a13462367
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: IE DownloadLink problems

Posted by wheleph <wh...@gmail.com>.

wheleph wrote:
> 
> Content-Disposition attachment; filename=%D0%A1 ...
> I wonder what encoding is it?
> 

It's url encoding. I used URLCodec from commons-codec
(http://commons.apache.org/codec/) package to encode file name for IE but
for FF I still need Base64 or Q-encoding. That's why I need to detect the
type of user's browser and send appropriately encoded file name (see the
snippet below). I think it would be nice improvement for DownloadLink to
perform the encoding of file name internally.

[code]
	WebResponse r = (WebResponse) requestCycle.getResponse();
	WebClientInfo clientInfo = (WebClientInfo) requestCycle.getClientInfo();
	final String userAgent = clientInfo.getUserAgent();
	logger.info("userAgent: " + userAgent);

	StringEncoder codec = null;
	if (userAgent.indexOf("MSIE") != -1) {
		codec = new URLCodec();
	} else {
		codec = new BCodec();
	}
	final String name = ecoFile.getName();
	String encodedName = null;
	try {
		encodedName = codec.encode(name);
	} catch (EncoderException e) {
		encodedName = ecoFile.getName();
		final String message = "Error while encoding name " + name + " with codec
" + codec;					logger.warn(message, e);
	}
	r.setAttachmentHeader(encodedName);

	// copy byte stream from file to response...
[/code]

wheleph
-- 
View this message in context: http://www.nabble.com/IE-DownloadLink-problems-tf4697141.html#a13462367
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: IE DownloadLink problems

Posted by Johan Compagner <jc...@gmail.com>.
hmm don't know directly what is causing that but
i do get more and more those files names. My downloads folder is full of
filenames starting with utf-8xxxxx
for example all the patches i download from or jira issue tracker seems to
do that also...

johan



On 10/26/07, wheleph <wh...@gmail.com> wrote:
>
>
> I Explored :) that IE expects input
> Content-Disposition     attachment; filename=%D0%A1 ...
> instead of
> Content-Disposition     attachment; filename==?utf-8?Q?=D0=A1 ...
> I wonder what kind of encoding is it?
>
> wheleph
>
>
> --
> View this message in context:
> http://www.nabble.com/IE-DownloadLink-problems-tf4697141.html#a13428214
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: IE DownloadLink problems

Posted by wheleph <wh...@gmail.com>.
I Explored :) that IE expects input
Content-Disposition	attachment; filename=%D0%A1 ...
instead of
Content-Disposition	attachment; filename==?utf-8?Q?=D0=A1 ...
I wonder what kind of encoding is it?

wheleph


-- 
View this message in context: http://www.nabble.com/IE-DownloadLink-problems-tf4697141.html#a13428214
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org