Download file with Unicode file name

Files and folders downloader add-on with resume support.
dollylamb
Posts: 5
Joined: Mon Nov 28, 2011 8:03 am

Download file with Unicode file name

Post by dollylamb »

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

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Download file with Unicode file name

Post by support »

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.49 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.86 MiB) Downloaded 13563 times
Does it help?

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

Re: Download file with Unicode file name

Post by dollylamb »

Many thanks. I'll try and let you know.

truongvu
Posts: 39
Joined: Wed Oct 26, 2011 11:58 am

Re: Download file with Unicode file name

Post by truongvu »

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 !

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Download file with Unicode file name

Post by support »

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

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

Re: Download file with Unicode file name

Post by dollylamb »

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

Post by dollylamb »

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 ?

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Download file with Unicode file name

Post by support »

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

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

Re: Download file with Unicode file name

Post by dollylamb »

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.

vlad
Posts: 82
Joined: Sun Jan 04, 2009 6:38 pm

Re: Download file with Unicode file name

Post by vlad »

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.

Post Reply