R. David Murray <rdmur...@bitdance.com> added the comment:

This is surprisingly non-transparent.  However, it works as documented
in py3.

It sorta works as documented in p2, except that there's a bit left out
of the docs.

In py2, the code that results in getfilesystemencoding's value sets the
locale based on the environment, does the nl_langinfo(CODESET), and then
restores the locale to the default (C).

In py3, python initialization sets LC_CTYPE to the enviroment, and uses
that to determine getsystemfilencoding's default value.  LC_CTYPE is
left set to the environment.

This means that in py2, using locale.nl_langinfo doesn't get you the
same value that is used to set getfilesystemencoding until after you've
done a call to set the locale to the environment.  In py3, however,
locale.nl_langinfo(locale.CODESET) will by default return the value that
is used to set getfilesystemencoding's value.

If you'd like to submit a doc patch for p2, please feel free, and I'll
apply it.

----------
nosy: +r.david.murray

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

Reply via email to