[New-bugs-announce] [issue8775] Use locale encoding to decode sys.argv, not the file system encoding
report at bugs.python.org
Thu May 20 14:09:25 CEST 2010
New submission from STINNER Victor <victor.stinner at haypocalc.com>:
The file system is hardcoded to UTF-8 on Mac OS X, whereas the locale encoding... depends on the locale. See issue #4388 for the details.
I think that we should use the locale encoding to encode and decode command line arguments. We have to create a new encoding variable used for the command line arguments:
* (no sys.setcmdlineencoding() please!)
This encoding only should be used on POSIX: Windows native type is unicode (wchar_t*). It should be used to decode sys.argv and to encode child processes arguments (subprocess, os.exec*(), etc.)).
On Linux, it should change anything because the file system encoding is the locale encoding. Said differently, Python3 does already use the locale encoding for the command arguments on Linux.
If you pass a filename on the command line and then open it: the filename is decoded with the locale encoding, and then encoded with the file system encoding. I fear that it will fail if both encodings are differents...
title: Use locale encoding to decode sys.argv, not the file system encoding
versions: Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce