Message109333
| Author |
piro |
| Recipients |
piro |
| Date |
2010年07月05日.16:07:51 |
| SpamBayes Score |
4.9936698e-05 |
| Marked as misclassified |
No |
| Message-id |
<1278346074.17.0.914375109611.issue9167@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年07月05日 16:07:58 | piro | set | recipients:
+ piro |
| 2010年07月05日 16:07:54 | piro | set | messageid: <1278346074.17.0.914375109611.issue9167@psf.upfronthosting.co.za> |
| 2010年07月05日 16:07:52 | piro | link | issue9167 messages |
| 2010年07月05日 16:07:51 | piro | create |
|