Download file with Unicode file name

Files and folders downloader add-on with resume support.

Download file with Unicode file name

Postby dollylamb » Mon Nov 28, 2011 8:09 am

Hi,

Is jFileDownload supports download file with Unicode file name? I tried jFileDownload with Unicode file and the result is always: Download failed: <file> not found.

Thanks
dollylamb
 
Posts: 5
Joined: Mon Nov 28, 2011 8:03 am

Re: Download file with Unicode file name

Postby support » Mon Nov 28, 2011 8:30 pm

Yes, it works. See screenshot below with Japanese characters. I guess you have a problem with encoding.
screenshot.png
Applet with Japanese file download
(76.72 KiB) Not downloaded yet

Make sure you have:
In HTML:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


In JavaScript:
document.writeln('<PARAM NAME="encoding" VALUE="UTF-8">');


In server-side script (i.e. for JSP)
...
String encoding = "UTF-8";
...
request.setCharacterEncoding(encoding);
response.setContentType("text/html; charset="+encoding);
...


I also enclose a full working/tested sample for JFileUpload + JFileDownload + JSAPI 2.9 Pro:
JFD-JSAPI2.9.zip
Full sample 2.9
(4.88 MiB) Downloaded 13434 times


Does it help?
User avatar
support
 
Posts: 1501
Joined: Sun Jan 27, 2008 6:19 pm

Re: Download file with Unicode file name

Postby dollylamb » Tue Nov 29, 2011 1:38 am

Many thanks. I'll try and let you know.
dollylamb
 
Posts: 5
Joined: Mon Nov 28, 2011 8:03 am

Re: Download file with Unicode file name

Postby truongvu » Tue Nov 29, 2011 3:44 am

I also have this problem .
I tested on Windows 7 but it still display 'Donwload failed: cars_1918要求仕様書.jpg not found' !
I think this sample run well on Linux . Can it run well on Window ?

I use PHP but I can't find code for encoding UTF-8 in server script . Where can I put it ?
Thanks for reply !
truongvu
 
Posts: 39
Joined: Wed Oct 26, 2011 11:58 am

Re: Download file with Unicode file name

Postby support » Tue Nov 29, 2011 7:23 am

Sample was tested under JRE 1.6 + Tomcat 6 + Windows Vista.
Double check encoding support in PHP, see:
http://htmlpurifier.org/docs/enduser-utf8.html
or
http://www.phpwact.org/php/i18n/charsets
User avatar
support
 
Posts: 1501
Joined: Sun Jan 27, 2008 6:19 pm

Re: Download file with Unicode file name

Postby dollylamb » Thu Dec 01, 2011 8:09 am

Hi,

Using your new 2.9 sample script doesn't help much. I still facing "File not found" problem. Below are what i have done:
- Set javascript & html page encode to UTF-8
- Set server side script encode to UTF-8

However, in server side script if I download a file with non-latin file name then the script stop right after "list" command.

Any ideas?
dollylamb
 
Posts: 5
Joined: Mon Nov 28, 2011 8:03 am

Re: Download file with Unicode file name

Postby dollylamb » Fri Dec 02, 2011 4:09 am

Hi,

It seems like there was a wrong file name comparison in getHTTPRemoteTFile function (wrong encoding or something?) so server side script never has a chance to be called ?
dollylamb
 
Posts: 5
Joined: Mon Nov 28, 2011 8:03 am

Re: Download file with Unicode file name

Postby support » Fri Dec 02, 2011 7:27 pm

Or it may be a problem in you server-side script. It works fine here. We've tested with Japanase file + JSP/TOMCAT/JRE1.6
User avatar
support
 
Posts: 1501
Joined: Sun Jan 27, 2008 6:19 pm

Re: Download file with Unicode file name

Postby dollylamb » Tue Dec 06, 2011 6:38 am

Hi,

Server side script never be called, so i doubt it is a server side script problem. I used your downloader with PHP + IIS web server not JSP + Apache Tomcat. Have you ever tested your downloader with above server spec? However, i'll try JSP + Tomcat if it works. Thank you for your support.
dollylamb
 
Posts: 5
Joined: Mon Nov 28, 2011 8:03 am

Re: Download file with Unicode file name

Postby vlad » Fri Sep 21, 2012 3:34 pm

I am also having a problem with UTF-8 encoded file names. I have a script that lists files and JFileDownload is making proper HTTP requests back to download each file. It has the filenames right, as the server side script is able to provide the requested downloads. However, I believe JFileDownload is not decoding the filename from UT-8 before saving it to disk.
The filename "Iñtërnâtiônàlizætiøn.rar" ends on the disk as "Iñtërnâtiônàlizætiøn.rar". The same messed up name is also displayed in the applet, while downloading.
The server is providing the following headers:
Code: Select all
Content-Type: application/download; charset=UTF-8
Content-Disposition: attachment; filename="Iñtërnâtiônàlizætiøn.rar"

The Java applet should decode the "filename" using the provided charset. All browsers work perfectly fine with the same script, so I assume the problem is from JFileDownload.
vlad
 
Posts: 82
Joined: Sun Jan 04, 2009 6:38 pm

Next

Return to JFileDownload



cron

Sitemap | Privacy Statement | Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc.
in the U.S. and other countries. All other company and/or product names are the property of their respective owners.