Issue239

Title Script compiled by Nuitka is unable to interpret non ascii characters in command line arguments
Priority bug Status chatting
Superseder Nosy List davidbaack, kayhayen
Assigned To kayhayen Keywords

Created on 2015-08-28.23:28:37 by davidbaack, last changed by davidbaack.

Messages
msg1490 (view) Author: davidbaack Date: 2015-08-29.02:32:56
Sure, when I run print(sys.getfilesystemencoding()) I get mbcs, which I 
believe is standard on Windows.
msg1489 (view) Author: kayhayen Date: 2015-08-29.01:55:28
David,

can you tell me what kind of input decoding you have? It should be 
print(sys.getfilesystemencoding()) and be different from my cp850 obviously.

Yours,
Kay
msg1488 (view) Author: davidbaack Date: 2015-08-29.01:42:57
Not sure about Python 2, only tried it with 3

On Fri, Aug 28, 2015 at 6:04 PM, Kay Hayen (via Issue Tracker) <
issue_tracker@nuitka.net> wrote:

>
> Kay Hayen <kay.hayen@gmail.com> added the comment:
>
> For Python3 I get this:
>
> $ /c/Python34_64/python Mini.py ЖДА乙
> Traceback (most recent call last):
>   File "Mini.py", line 2, in <module>
>     print(sys.argv)
>   File "c:\Python34_64\lib\encodings\cp850.py", line 19, in encode
>     return codecs.charmap_encode(input,self.errors,encoding_map)[0]
> UnicodeEncodeError: 'charmap' codec can't encode characters in position
> 13-16: character maps to <undefined>
>
> For Python2 I get this:
>
> $ /c/Python27_64/python Mini.py ЖДА乙
> ['Mini.py', '????']
>
> Doing os.path.exists on sys.argv fails on Python2 for me, gives false,
> although
> the directory does exist. For Python2 I think unicode command line
> arguments
> cannot work.  So, I believe, I should have some other locale for Python3,
> I suppose,
> or what, but unsure how to do that.
>
> Yours,
> Kay
>
> _______________________________________________
> Nuitka issue tracker <issue_tracker@nuitka.net>
> <http://bugs.nuitka.net/issue239>
> _______________________________________________
>
msg1487 (view) Author: kayhayen Date: 2015-08-29.01:04:41
For Python3 I get this:

$ /c/Python34_64/python Mini.py ЖДА乙
Traceback (most recent call last):
  File "Mini.py", line 2, in <module>
    print(sys.argv)
  File "c:\Python34_64\lib\encodings\cp850.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 13-16: character maps to <undefined>

For Python2 I get this:

$ /c/Python27_64/python Mini.py ЖДА乙
['Mini.py', '????']

Doing os.path.exists on sys.argv fails on Python2 for me, gives false, although
the directory does exist. For Python2 I think unicode command line arguments
cannot work.  So, I believe, I should have some other locale for Python3, I suppose,
or what, but unsure how to do that.

Yours,
Kay
msg1486 (view) Author: kayhayen Date: 2015-08-29.00:56:45
Is this Python2 or Python3?

Yours,
Kay
msg1485 (view) Author: davidbaack Date: 2015-08-28.23:28:37
Tested using this program called test.py on Windows 8 64 bit:

import os
import sys

directory = sys.argv[1]
if not os.path.exists(directory):
	os.makedirs(directory)

Invoking the program on the windows command line with test.exe ЖДА乙 results 
in the error OSError: [WinError 123] The filename, directory name, or volume 
label syntax is incorrect: '????'

However, I noticed that if I compile my program using py2exe, it succeeds as 
expected, so I do believe it is a Nuitka specific issue. Thanks, and feel 
free to let me know if I can provide more info!
History
Date User Action Args
2015-08-29 02:32:56davidbaacksetmessages: + msg1490
2015-08-29 01:55:28kayhayensetmessages: + msg1489
2015-08-29 01:42:57davidbaacksetmessages: + msg1488
2015-08-29 01:04:41kayhayensetmessages: + msg1487
2015-08-29 00:56:45kayhayensetstatus: unread -> chatting
assignedto: kayhayen
messages: + msg1486
nosy: + kayhayen
2015-08-28 23:28:37davidbaackcreate