Can't download file to non-ascii path

Bug reports and enhancement requests
Post Reply
gfdice
Posts: 2
Joined: Mon Jan 17, 2011 1:47 am

Can't download file to non-ascii path

Post by gfdice »

Win7(Simplified Chinese Version, ansi encoding = gbk/cp936) + Firefox 3.6.13 + flashgot 1.2.8
In the FlashGot destination directory dialog, I choosed a non-ascii path, then the customed downloader received a wrong path(garbled characters) via command line.
I guess the problem is the wrong conversion between different encodings.

Don't know much about Firefox plugins and javascript, and I can't find the codes which launched the customed downloader.
For windows, there are some win32 apis to created a new process, such as ShellExecute. If you are using ShellExecute, the command line arguments should be converted with ANSI encoding; if you are using ShellExecuteW, the command line should be in the format of wchar_t*, which is in fact UTF16le encoded string.

I really appreciate your reply.
Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Can't download file to non-ascii path

Post by Giorgio Maone »

Custom downloaders use the nsIProcess XPCOM API, which wraps ShellExecute() variants.

Unfortunately it seems to use ANSI (it works with Window-1252 "high" characters on my system) rather than Unicode for command line arguments, at least on Firefox < 4.

Firefox 4 seems in a better position, http://mxr.mozilla.org/comm-1.9.2/diff? ... al&diffw=1

I'll look into this new runw() method and add a branching for Firefox 4 if it serves the purpose.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
gfdice
Posts: 2
Joined: Mon Jan 17, 2011 1:47 am

Re: Can't download file to non-ascii path

Post by gfdice »

Thanks for your reply :D
runw() seems to do the right thing, but firefox4 is still in beta, and many plugins I like need more time to keep up with it :|
So, I need a work-around for firefox3... Is there any means to convert strings to ansi encoding before sending it to the customed downloader?
Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Can't download file to non-ascii path

Post by Giorgio Maone »

gfdice wrote:Is there any means to convert strings to ansi encoding before sending it to the customed downloader?
Not that I know.
BTW, the Firefox 4 feature is implemented in latest development build, thank you.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Post Reply