Closed eromoe closed 8 years ago
I think I found the problem :
After I remove win_unicode_console.enable()
from usercustomize.py.
E:\[Sync]\project\auto_shift>python exe.py -p E:\同人本\シュート・ザ・ムーン (フエタキシ)
1
usage: exe.py [-h] [-p PATH]
exe.py: error: unrecognized arguments: (フエタキシ)
The argparse
would throw an error, this error msg can not be decode.
Then add usercustomize.py.
back, and use the correct input:
E:\[Sync]\project\auto_shift>python exe.py -p "E:\同人本\シュート・ザ・ムーン (フエタキシ)"
1
2
Seems win-unicode-console can not handle the output from python build-in lib?
Generally, there may problem with giving Unicode argument to a Python 2 script, the bytes in sys.argv
may even not be a faithful representation of the original string. See #20 . Maybe I'll add code like that to win_unicode_console
.
Yeah, that would be great!
+1
There is some progress with #20. But for your particular code, you may turn sys.argv
to Unicode before parsing rather than after:
args = [unicode(arg, "gbk") if not isinstance(arg, unicode) else arg for arg in sys.argv]
args = parser.parse_args(args)
I have below code :
My windows7 cmd encoding is
gbk
(a Chinese encoding)Chinese work fine
But Japanese go wrong.