Index: Python/pythonrun.c =================================================================== --- Python/pythonrun.c (révision 81227) +++ Python/pythonrun.c (copie de travail) @@ -712,8 +712,8 @@ PyErr_Clear(); fprintf(stderr, "Unable to get the locale encoding: " - "fallback to utf-8\n"); - Py_FileSystemDefaultEncoding = "utf-8"; + "fallback to ascii\n"); + Py_FileSystemDefaultEncoding = "ascii"; Py_HasFileSystemDefaultEncoding = 1; #endif Index: Python/bltinmodule.c =================================================================== --- Python/bltinmodule.c (révision 81227) +++ Python/bltinmodule.c (copie de travail) @@ -29,7 +29,7 @@ const char *Py_FileSystemDefaultEncoding = NULL; /* set by initfsencoding() */ int Py_HasFileSystemDefaultEncoding = 0; #else -const char *Py_FileSystemDefaultEncoding = "utf-8"; +const char *Py_FileSystemDefaultEncoding = "ascii"; int Py_HasFileSystemDefaultEncoding = 1; #endif Index: Include/unicodeobject.h =================================================================== --- Include/unicodeobject.h (révision 81227) +++ Include/unicodeobject.h (copie de travail) @@ -1248,7 +1248,7 @@ /* Decode a null-terminated string using Py_FileSystemDefaultEncoding and the "surrogateescape" error handler. - If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8. + If Py_FileSystemDefaultEncoding is not set, fall back to ASCII. Use PyUnicode_DecodeFSDefaultAndSize() if the string length is known. */ @@ -1260,7 +1260,7 @@ /* Decode a string using Py_FileSystemDefaultEncoding and the "surrogateescape" error handler. - If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8. + If Py_FileSystemDefaultEncoding is not set, fall back to ASCII. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize( @@ -1271,7 +1271,7 @@ /* Encode a Unicode object to Py_FileSystemDefaultEncoding with the "surrogateescape" error handler, and return bytes. - If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8. + If Py_FileSystemDefaultEncoding is not set, fall back to ASCII. */ PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault( Index: Objects/unicodeobject.c =================================================================== --- Objects/unicodeobject.c (révision 81227) +++ Objects/unicodeobject.c (copie de travail) @@ -1468,7 +1468,7 @@ Py_FileSystemDefaultEncoding, "surrogateescape"); else - return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode), + return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(unicode), PyUnicode_GET_SIZE(unicode), "surrogateescape"); } @@ -1632,7 +1632,7 @@ "surrogateescape"); } else { - return PyUnicode_DecodeUTF8(s, size, "surrogateescape"); + return PyUnicode_DecodeASCII(s, size, "surrogateescape"); } } Index: Doc/c-api/unicode.rst =================================================================== --- Doc/c-api/unicode.rst (révision 81227) +++ Doc/c-api/unicode.rst (copie de travail) @@ -392,7 +392,7 @@ Decode a null-terminated string using :cdata:`Py_FileSystemDefaultEncoding` and the ``"surrogateescape"`` error handler. - If :cdata:`Py_FileSystemDefaultEncoding` is not set, fall back to UTF-8. + If :cdata:`Py_FileSystemDefaultEncoding` is not set, fall back to ASCII. Use :func:`PyUnicode_DecodeFSDefaultAndSize` if you know the string length. @@ -402,7 +402,7 @@ Decode a string using :cdata:`Py_FileSystemDefaultEncoding` and the ``"surrogateescape"`` error handler. - If :cdata:`Py_FileSystemDefaultEncoding` is not set, fall back to UTF-8. + If :cdata:`Py_FileSystemDefaultEncoding` is not set, fall back to ASCII. .. cfunction:: PyObject* PyUnicode_EncodeFSDefault(PyObject *unicode) @@ -410,7 +410,7 @@ Encode a Unicode object to :cdata:`Py_FileSystemDefaultEncoding` with the ``'surrogateescape'`` error handler, and return :class:`bytes`. - If :cdata:`Py_FileSystemDefaultEncoding` is not set, fall back to UTF-8. + If :cdata:`Py_FileSystemDefaultEncoding` is not set, fall back to ASCII. .. versionadded:: 3.2 Index: Doc/library/sys.rst =================================================================== --- Doc/library/sys.rst (révision 81227) +++ Doc/library/sys.rst (copie de travail) @@ -304,7 +304,7 @@ * On Mac OS X, the encoding is ``'utf-8'``. * On Unix, the encoding is the user's preference according to the result of - nl_langinfo(CODESET), or ``'utf-8'`` if ``nl_langinfo(CODESET)`` failed. + nl_langinfo(CODESET), or ``'ascii'`` if ``nl_langinfo(CODESET)`` failed. * On Windows NT+, file names are Unicode natively, so no conversion is performed. :func:`getfilesystemencoding` still returns ``'mbcs'``, as