"Escape hatch" for preferred encoding (default encoding for `open`)

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.
participants (1)
-
Ionel Maries Cristian