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) 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 about this problem but to my bewilderment no one considered using an environment variable.