Comment 17 for bug 335362

Revision history for this message
methane (songofacandy) wrote : Re: [Bug 335362] Re: UnicodeDecodeError when processing paths that have the character ä

>> But, Windows locale encoding is not support all of unicode chars.
>> To support Unicode filenames, I can think following ways.
>>  1. Use Py3k ;-)
>>  2. Use ctypes.GetCommandLineW()
>>  3. Use urlencode for filenames. ( file:///D:/%uXXXX...)
>>  4. pass filenames with stdin instead of commandline arguments.
>>
>> ** Attachment added: "decode filenames with get_user_encoding()"
>>    http://launchpadlibrarian.net/27783268/fenc2.patch
>>
>
> The way we get the command line has changed in recent versions. We now
> use GetCommandLineW function (IIRC), and we expect the arguments passed
> to main() are going to be Unicode arguments.

I read Python source code and found that py2k uses main(int, char**) and py3k
uses wmain(int, wchar_t**). I couldn't find GetCommandLineW.
So I think there are no way to get sys.argv in unicode on py2k.