Folder/subfolder name contains "5C"-byte

Files and folders downloader add-on with resume support.
Post Reply
truongvu
Posts: 39
Joined: Wed Oct 26, 2011 11:58 am

Folder/subfolder name contains "5C"-byte

Post by truongvu »

Hello,

We cannot download folder/subfolder whose name contains "5C"-byte. Using version JfileDownload 2.9

Example : 全表示

Thank you for any help

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

Re: Folder/subfolder name contains "5C"-byte

Post by support »

Could you provide the full URL with 5C char?
And your JavaScript too with applet declaration.

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

Re: Folder/subfolder name contains "5C"-byte

Post by truongvu »

support wrote:Could you provide the full URL with 5C char?
And your JavaScript too with applet declaration.
My current developing evironment is Japanese locale , Symfomy PHP
When using Japanese locale , I can not download folder with Japanese character as "C:\data\全表示"
So i have to use function mb_convert_encoding() to encode Japanese char to Shift_Jis
Example: 全表示 -> �S�\�� (with \ is 5C character)

Jfiledownload show message "Download failed: 全表示 not found"

I think this function of jfiledownload prevent me to download folder.
print($type." ".$date." ".$size." ".$name."<br>\n");

Can you give me any advice for this case ?
Hope receiving your reply !!!

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

Re: Folder/subfolder name contains "5C"-byte

Post by support »

Please provide a ZIP with your HTML + Javacript too.

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

Re: Folder/subfolder name contains "5C"-byte

Post by support »

We've made test with filename such as cars_1918全表示.jpg. You have a live demo at:
http://www.jfileupload.com/products/dem ... nload.html
First file to download is samplefile200901.jpg and second one is cars_1918全表示.jpg
Resume/overwrite/skip options are enabled.

It works fine if you've setup UTF-8 encoding correctly everywhere it is needed.

In applet_http_download.html:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
In applet_http_download.js:

Code: Select all

...
document.write('encoding="UTF-8" ');
document.write('item2="cars_1918全表示.jpg" ');
...
document.writeln('<PARAM NAME="encoding" VALUE="UTF-8">');
document.writeln('<PARAM NAME="item2" VALUE="cars_1918全表示.jpg">');
...
Also, make sure your applet_http_download.js file is saved with UTF-8 encoding too.

In server-side PHP script:

Code: Select all

$encoding="UTF-8";
header('Content-Type: text/html; charset='.$encoding);
Then:
print($type." ".$date." ".$size." ".$name."<br>\n");
will return UTF-8 that will be read by JFileDownload.

I enclose my PHP scripts + HTML + JavaScript. In addition to the live demo, it should help you to understand what's wrong with your configuration.
UTF8Support.zip
JFileDownload with UTF-8 and Japanese file
(7.35 KiB) Downloaded 769 times

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

Re: Folder/subfolder name contains "5C"-byte

Post by truongvu »

Ok , i see if I use charset UTF-8 is not generating error
The system I am using required charset is Shift_JIS
I am using SQL Server (locale Japanese) + Symfony PHP + Window locale Japanese
When i change charset Shift_JIS to UTF-8 , file not found when download.
So i must use Shift_JIS charset to download file --> errors happen include download file having 5C character (\)

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

Re: Folder/subfolder name contains "5C"-byte

Post by support »

I don't see why it works on our server and not on yours. Did you check the online demo? UTF-8 is designed for all languages such as Japanese, Chinese, German,...
If you must store filename as SHIFT_JIS then you could convert SHIFT_JIS to UTF-8 in PHP in explorer.php and UTF-8 to SHIFT_JIS on upload, do you?

Post Reply