[Python-ideas] "Escape hatch" for preferred encoding (default encoding for `open`)

Ionel Maries Cristian ionel.mc at gmail.com
Sat Jun 21 18:57:04 CEST 2014


It would be nice if there would be an escape hatch for situations where the
value of locale.getpreferredencoding() can't be changed (eg: windows - try
changing that to utf8
<http://blog.ionelmc.ro/2014/06/19/just-another-day-using-python-3/>) in
the form of an environment variable like PYTHONPREFERREDENCODING (or
something like that).

The idea is that it would override the default encoding for open() for
platforms/situations where it's infeasible to manually specify the encoding
to open (eg: lots of old code) or change locale to something utf8-ish
(windows).

I've found an old thread
<http://grokbase.com/t/python/python-dev/116w24gdra/open-set-the-default-encoding-to-utf-8-in-python-3-3>
about this problem but to my bewilderment no one considered using an
environment variable.


Thanks,
-- Ionel M.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140621/aebdcdcd/attachment.html>


More information about the Python-ideas mailing list