mirror of
https://github.com/python/cpython.git
synced 2025-09-03 07:28:59 +00:00
Issue #8610: Load file system codec at startup, and display a fatal error on
failure. Set the file system encoding to utf-8 (instead of None) if getting the locale encoding failed, or if nl_langinfo(CODESET) function is missing.
This commit is contained in:
parent
06ba9ade85
commit
b744ba1d14
4 changed files with 62 additions and 27 deletions
|
@ -9,6 +9,10 @@
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_LANGINFO_H
|
||||
#include <langinfo.h> /* CODESET */
|
||||
#endif
|
||||
|
||||
/* The default encoding used by the platform file system APIs
|
||||
Can remain NULL for all platforms that don't have such a concept
|
||||
|
||||
|
@ -21,9 +25,12 @@ int Py_HasFileSystemDefaultEncoding = 1;
|
|||
#elif defined(__APPLE__)
|
||||
const char *Py_FileSystemDefaultEncoding = "utf-8";
|
||||
int Py_HasFileSystemDefaultEncoding = 1;
|
||||
#else
|
||||
const char *Py_FileSystemDefaultEncoding = NULL; /* use default */
|
||||
#elif defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||
const char *Py_FileSystemDefaultEncoding = NULL; /* set by initfsencoding() */
|
||||
int Py_HasFileSystemDefaultEncoding = 0;
|
||||
#else
|
||||
const char *Py_FileSystemDefaultEncoding = "utf-8";
|
||||
int Py_HasFileSystemDefaultEncoding = 1;
|
||||
#endif
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue