Martin v. Löwis <mar...@v.loewis.de> added the comment:

Antoine: Python cannot possibly know whether a command line argument is meant 
as a file name or as some other text, and what encoding the receiving 
application will apply to it (if any).

I agree it's best to have all "IO" encodings being the same in Python, but 
perhaps there are use cases where you have to use a different encoding for file 
names, so I don't think it is necessary to rip this feature out.

So perhaps it would be best if Python had two external default encodings: the 
IO one (command line arguments, environment variables, text files), and the 
file name encoding (defaulting to the IO encoding if not set). If they differ 
and you get mojibake in subprocesses: bad luck - it's exactly what you asked 
for. 

The fsname encoding should *only* be used for file names, not for command line 
arguments in subprocess.

If we have tests that rely on the fsname encoding and the IO encoding being the 
same, then those tests should get skipped if the encodings are actually 
different.

The tricky parts remains determining the IO encoding. If PYTHONIOENCODING can 
override the locale's encoding, then the tricky question is how command line 
arguments should get decoded in absence of the codec machinery on Unix. They 
must get decoded for uniformity with Windows (which received the command line 
as a Unicode string already).

That problem may be the reason why we need *three* encodings (as it is now), 
the IOENCODING only applying to file streams.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9992>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to