I am wondering how the python source code set the value to Py_FileSystemDefaultEncoding. And I get a strange thing.
Since the python doc about sys.getfilesystemencoding () said that:
On Unix, encoding is the preference of users according to the result of nl_langinfo (CODESET) or None if nl_langinfo (CODESET) failed.
I am using python 2.7.6
`` ``
>>>import sys >>>sys.getfilesystemencoding() >>>'UTF-8' >>>import locale >>>locale.nl_langinfo(locale.CODESET) >>>'ANSI_X3.4-1968'
`` ``
Here's the question: why is the value of getfilesystemencoding () different from the value of locale.nl_landinfo (), as the document says that getfilesystemencoding () comes from locale.nl_landinfo ().
Here is the output of the locale command in my terminal:
LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_CTYPE="en_US.UTF-8" LC_NUMERIC=zh_CN.UTF-8 LC_TIME=zh_CN.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES="en_US.UTF-8" LC_PAPER=zh_CN.UTF-8 LC_NAME=zh_CN.UTF-8 LC_ADDRESS=zh_CN.UTF-8 LC_TELEPHONE=zh_CN.UTF-8 LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=zh_CN.UTF-8 LC_ALL=
andy
source share