Page 1 of 1

Can't download file to non-ascii path

Posted: Tue Jan 18, 2011 2:38 am
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.

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

Posted: Tue Jan 18, 2011 10:55 am
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.

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

Posted: Wed Jan 19, 2011 2:11 am
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?

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

Posted: Wed Jan 26, 2011 1:15 am
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.