You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by souravm <SO...@infosys.com> on 2006/01/06 04:35:32 UTC

Sending file name containing unicode characters in http file download

Hi All,



I've an application which can be used for downloading file over web. Now
if the file name contains Unicode characters which are not in iso-8859-1
range, the name appearing at the browser (in the download window asking
for save) coming as junk.



I'm passing the fine name through http header by setting the filename
parameter. The code is written in JSP.



In this context I need to know following things -



1.	As I was aware through http header one cannot send non
iso-8859-1 characters. Is this problem happening due to the same reason
?
2.	If the answer to above Qs is yes, the what is the solution/work
around for downloading a file having name with Unicode characters which
are not in iso-8859-1 range in http file download ?



Any input/pointer would be highly appreciated.



Regards,

Sourav



**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Re: Sending file name containing unicode characters in http file download

Posted by Laurie Harper <la...@holoweb.net>.
You don't have any control over the client-side decoding; the browser 
will look at the HTTP header and 'do it's thing' with it. There is a way 
to do this, I think there's an encoding mechanism you can use for 
non-ASCII header data. I'm not sure if it's standardized by HTML or one 
of those 'by convention' things though.

Just had a quick look at some old code, which turned out not to be doing 
exactly what I'd expect (!) but I *think* what you need to do is to 
convert the filename into a byte stream using the request encoding, then 
URL encode that byte stream and use the result as the filename in the 
Content-Disposition header.

L.

Daniel Blumenthal wrote:
> Sourav,
> 
> I'm not sure, but I'd guess that you'd want to encode it as a transportable
> UTF-8 format on the server side, and decode it on the client side.  Assuming
> that this is, in fact, what you need to do, you can find instructions on
> doing it here:
> 
> http://www.w3.org/International/O-URL-code.html
> 
> Good luck!
> 
> Daniel
> 
>> -----Original Message-----
>> From: souravm [mailto:SOURAVM@infosys.com] 
>> Sent: Thursday, January 05, 2006 10:36 PM
>> To: Struts Users Mailing List
>> Subject: Sending file name containing unicode characters in 
>> http file download
>>
>>
>> Hi All,
>>
>>  
>> I've an application which can be used for downloading file 
>> over web. Now if the file name contains Unicode characters 
>> which are not in iso-8859-1 range, the name appearing at the 
>> browser (in the download window asking for save) coming as junk.
>>
>>  
>> I'm passing the fine name through http header by setting the 
>> filename parameter. The code is written in JSP.
>>
>>  
>> In this context I need to know following things -
>>
>>  
>> 1.	As I was aware through http header one cannot send non
>> iso-8859-1 characters. Is this problem happening due to the 
>> same reason ?
>> 2.	If the answer to above Qs is yes, the what is the solution/work
>> around for downloading a file having name with Unicode 
>> characters which are not in iso-8859-1 range in http file download ?
>>
>>  
>> Any input/pointer would be highly appreciated.
>>
>>  
>> Regards,
>>
>> Sourav
>>
>>
>>
>> **************** CAUTION - Disclaimer ***************** This 
>> e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION 
>> intended solely for the use of the addressee(s). If you are 
>> not the intended recipient, please notify the sender by 
>> e-mail and delete the original message. Further, you are not 
>> to copy, disclose, or distribute this e-mail or its contents 
>> to any other person and any such actions are unlawful. This 
>> e-mail may contain viruses. Infosys has taken every 
>> reasonable precaution to minimize this risk, but is not 
>> liable for any damage you may sustain as a result of any 
>> virus in this e-mail. You should carry out your own virus 
>> checks before opening the e-mail or attachment. Infosys 
>> reserves the right to monitor and review the content of all 
>> messages sent to or from this e-mail address. Messages sent 
>> to or from this e-mail address may be stored on the Infosys 
>> e-mail system.
>> ***INFOSYS******** End of Disclaimer ********INFOSYS***


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Sending file name containing unicode characters in http file download

Posted by Daniel Blumenthal <da...@wordchamp.com>.
Sourav,

I'm not sure, but I'd guess that you'd want to encode it as a transportable
UTF-8 format on the server side, and decode it on the client side.  Assuming
that this is, in fact, what you need to do, you can find instructions on
doing it here:

http://www.w3.org/International/O-URL-code.html

Good luck!

Daniel

> -----Original Message-----
> From: souravm [mailto:SOURAVM@infosys.com] 
> Sent: Thursday, January 05, 2006 10:36 PM
> To: Struts Users Mailing List
> Subject: Sending file name containing unicode characters in 
> http file download
> 
> 
> Hi All,
> 
>  
> I've an application which can be used for downloading file 
> over web. Now if the file name contains Unicode characters 
> which are not in iso-8859-1 range, the name appearing at the 
> browser (in the download window asking for save) coming as junk.
> 
>  
> I'm passing the fine name through http header by setting the 
> filename parameter. The code is written in JSP.
> 
>  
> In this context I need to know following things -
> 
>  
> 1.	As I was aware through http header one cannot send non
> iso-8859-1 characters. Is this problem happening due to the 
> same reason ?
> 2.	If the answer to above Qs is yes, the what is the solution/work
> around for downloading a file having name with Unicode 
> characters which are not in iso-8859-1 range in http file download ?
> 
>  
> Any input/pointer would be highly appreciated.
> 
>  
> Regards,
> 
> Sourav
> 
> 
> 
> **************** CAUTION - Disclaimer ***************** This 
> e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION 
> intended solely for the use of the addressee(s). If you are 
> not the intended recipient, please notify the sender by 
> e-mail and delete the original message. Further, you are not 
> to copy, disclose, or distribute this e-mail or its contents 
> to any other person and any such actions are unlawful. This 
> e-mail may contain viruses. Infosys has taken every 
> reasonable precaution to minimize this risk, but is not 
> liable for any damage you may sustain as a result of any 
> virus in this e-mail. You should carry out your own virus 
> checks before opening the e-mail or attachment. Infosys 
> reserves the right to monitor and review the content of all 
> messages sent to or from this e-mail address. Messages sent 
> to or from this e-mail address may be stored on the Infosys 
> e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org