cpython/Include/cpython
Victor Stinner e662c398d8
bpo-42236: Use UTF-8 encoding if nl_langinfo(CODESET) fails (GH-23086)
If the nl_langinfo(CODESET) function returns an empty string, Python
now uses UTF-8 as the filesystem encoding.

In May 2010 (commit b744ba1d14), I
modified Python to log a warning and use UTF-8 as the filesystem
encoding (instead of None) if nl_langinfo(CODESET) returns an empty
string.

In August 2020 (commit 94908bbc15), I
modified Python startup to fail with a fatal error and a specific
error message if nl_langinfo(CODESET) returns an empty string. The
intent was to prevent guessing the encoding and also investigate user
configuration where this case happens.

In 10 years (2010 to 2020), I saw zero user report about the error
message related to nl_langinfo(CODESET) returning an empty string.

Today, UTF-8 became the defacto standard and it's safe to make the
assumption that the user expects UTF-8. For example,
nl_langinfo(CODESET) can return an empty string on macOS if the
LC_CTYPE locale is not supported, and UTF-8 is the default encoding
on macOS.

While this change is likely to not affect anyone in practice, it
should make UTF-8 lover happy ;-)

Rewrite also the documentation explaining how Python selects the
filesystem encoding and error handler.
2020-11-01 23:07:23 +01:00
..
abstract.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
bytearrayobject.h bpo-35134: Add Include/cpython/bytesobject.h file (GH-18494) 2020-02-12 23:54:31 +01:00
bytesobject.h bpo-35134: Add Include/cpython/bytesobject.h file (GH-18494) 2020-02-12 23:54:31 +01:00
ceval.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
code.h bpo-40421: Add Include/cpython/code.h header file (GH-19756) 2020-04-28 17:07:12 +02:00
dictobject.h bpo-42006: Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId. (GH-22648) 2020-10-26 08:43:39 +02:00
fileobject.h bpo-41986: Add Py_FileSystemDefaultEncodeErrors and Py_UTF8Mode back to limited API (GH-22621) 2020-10-10 17:09:45 +03:00
fileutils.h bpo-35134: Add Include/cpython/fileutils.h header file (GH-18493) 2020-02-12 23:55:09 +01:00
frameobject.h bpo-40941: Unify implicit and explicit state in the frame and generator objects into a single value. (GH-20803) 2020-07-17 11:44:23 +01:00
import.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
initconfig.h bpo-42236: Use UTF-8 encoding if nl_langinfo(CODESET) fails (GH-23086) 2020-11-01 23:07:23 +01:00
interpreteridobject.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
listobject.h Fix typo in listobject.h (GH-22588) 2020-10-11 19:21:51 +01:00
methodobject.h bpo-38787: Add PyCFunction_CheckExact() macro for exact type checks (GH-20024) 2020-05-12 07:12:41 -07:00
object.h bpo-41991: Remove _PyObject_HasAttrId (GH-22629) 2020-10-10 22:23:42 +03:00
objimpl.h bpo-42208: Pass tstate to _PyGC_CollectNoFail() (GH-23038) 2020-10-30 17:00:00 +01:00
pyerrors.h bpo-41098: Doc: Add missing deprecated directives (GH-21162) 2020-08-07 16:31:53 +09:00
pylifecycle.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
pymem.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
pystate.h bpo-41936. Remove macros Py_ALLOW_RECURSION/Py_END_ALLOW_RECURSION (GH-22552) 2020-10-05 12:32:00 +03:00
sysmodule.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
traceback.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
tupleobject.h bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h (GH-18413) 2020-06-01 20:35:56 +02:00
unicodeobject.h bpo-41784: make PyUnicode_AsUTF8AndSize part of the limited API (GH-22252) 2020-10-19 23:17:50 +01:00