This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients ixokai, lemburg, loewis, pitrou, pjenvey, ronaldoussoren, vstinner
Date 2010-10-09.09:14:46
SpamBayes Score 1.9114577e-10
Marked as misclassified No
Message-id <1286615690.16.0.96067019245.issue9992@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-10-09 09:14:50loewissetrecipients: + loewis, lemburg, ixokai, ronaldoussoren, pitrou, vstinner, pjenvey
2010-10-09 09:14:50loewissetmessageid: <1286615690.16.0.96067019245.issue9992@psf.upfronthosting.co.za>
2010-10-09 09:14:48loewislinkissue9992 messages
2010-10-09 09:14:46loewiscreate