[issue8775] Use locale encoding to decode sys.argv, not the file system encoding

Martin v. Löwis report at bugs.python.org
Thu May 20 19:23:05 CEST 2010


Martin v. Löwis <martin at v.loewis.de> added the comment:

> I think that we should use the locale encoding to encode and decode command line arguments. 

I disagree. IIUC, this is only about OSX. Now, we shouldn't take any
action until either some OSX expert explains us how command line
arguments are being passed on OSX, or we find some Apple documentation
that can be taken as a specification.

I think the C locale is very poorly supported on OSX, and we shouldn't
really use it for anything. What may be useful is the terminal encoding
(which may be different both from UTF-8 and the locale encoding),
however, it's not possible to find out what the terminal encoding is.
In addition, programs may be started "directly" (i.e. not from the
terminal), in which case the terminal encoding would be irrelevant.

For file name arguments at least, it's very clear that the command line
arguments also use the file system encoding.

----------
nosy: +loewis
title: Use locale encoding to encode command line arguments (subprocess, os.exec*(), etc.) -> Use locale encoding to decode sys.argv, not the file system encoding

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


More information about the Python-bugs-list mailing list