[issue9167] argv double encoding on OSX

Daniele Varrazzo report at bugs.python.org
Tue Jul 6 14:16:53 CEST 2010


Daniele Varrazzo <piro at develer.com> added the comment:

I've made some other test with LANG=C on other platforms. It seems resulting in a clean error on Linux:

$ LANG=C ./here/bin/python3
Python 3.2a0 (py3k, Jul  6 2010, 12:40:29) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, os
>>> snowman = '\u2603'
>>> os.system((sys.executable + " -c 'import sys; print(sys.argv[-1].encode(\"utf8\"))' " + snowman).encode(sys.getdefaultencoding()))
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'utf-8' codec can't encode character '\udce2' in position 0: surrogates not allowed
256

Notice that I had to use an explicit encoding or os.system would have tried to encode using ascii and barf, probably because of bug #8775.

I've also been reported about issue #4388: I've checked and test_run_code() fails as described. So I think this bug can be considered a #4388 duplicate.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9167>
_______________________________________


More information about the Python-bugs-list mailing list