New submission from Daniele Varrazzo <p...@develer.com>: Looks like the wchar_t* array returned by Py_GetArgcArgv() on OSX suffers by double encoding. This can affect sys.argv, sys.executable and C code relying on the above function of course.
On Linux: $ python3 Python 3.0rc1+ (py3k, Oct 28 2008, 09:22:29) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os, sys >>> snowman = '\u2603' >>> os.system(sys.executable + " -c 'import sys; [print(a.encode(\"utf8\")) for >>> a in sys.argv]' foo bar " + snowman) b'-c' b'foo' b'bar' b'\xe2\x98\x83' 0 On OSX (uname -a is Darwin comicbookguy.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386) $ python3 Python 3.1.2 (r312:79147, Jul 5 2010, 11:57:14) [GCC 4.2.1 (Apple Inc. build 5659)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os, sys >>> snowman = '\u2603' >>> os.system(sys.executable + " -c 'import sys; [print(a.encode(\"utf8\")) for >>> a in sys.argv]' foo bar " + snowman) b'-c' b'foo' b'bar' b'\xc3\xa2\xc2\x98\xc2\x83' 0 Is this a known limitation of the platform? I don't know much about OSX, just found it testing for regressions in setproctitle <http://code.google.com/p/py-setproctitle/> Reported correctly working on Windows. ---------- components: Interpreter Core messages: 109333 nosy: piro priority: normal severity: normal status: open title: argv double encoding on OSX type: behavior versions: Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9167> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com