Issue #8965: initfsencoding() doesn't change the encoding on Mac OS X
File system encoding have to be hardcoded to "utf-8" on Mac OS X. r81190 introduced a regression: the encoding was changed depending on the locale.
This commit is contained in:
parent
2b293cf1a5
commit
7f84ab5952
@ -703,24 +703,26 @@ initfsencoding(void)
|
|||||||
#if defined(HAVE_LANGINFO_H) && defined(CODESET)
|
#if defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||||
char *codeset;
|
char *codeset;
|
||||||
|
|
||||||
/* On Unix, set the file system encoding according to the
|
if (Py_FileSystemDefaultEncoding == NULL) {
|
||||||
user's preference, if the CODESET names a well-known
|
/* On Unix, set the file system encoding according to the
|
||||||
Python codec, and Py_FileSystemDefaultEncoding isn't
|
user's preference, if the CODESET names a well-known
|
||||||
initialized by other means. Also set the encoding of
|
Python codec, and Py_FileSystemDefaultEncoding isn't
|
||||||
stdin and stdout if these are terminals. */
|
initialized by other means. Also set the encoding of
|
||||||
codeset = get_codeset();
|
stdin and stdout if these are terminals. */
|
||||||
if (codeset != NULL) {
|
codeset = get_codeset();
|
||||||
Py_FileSystemDefaultEncoding = codeset;
|
if (codeset != NULL) {
|
||||||
Py_HasFileSystemDefaultEncoding = 0;
|
Py_FileSystemDefaultEncoding = codeset;
|
||||||
return;
|
Py_HasFileSystemDefaultEncoding = 0;
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Unable to get the locale encoding: "
|
"Unable to get the locale encoding: "
|
||||||
"fallback to utf-8\n");
|
"fallback to utf-8\n");
|
||||||
Py_FileSystemDefaultEncoding = "utf-8";
|
Py_FileSystemDefaultEncoding = "utf-8";
|
||||||
Py_HasFileSystemDefaultEncoding = 1;
|
Py_HasFileSystemDefaultEncoding = 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* the encoding is mbcs, utf-8 or ascii */
|
/* the encoding is mbcs, utf-8 or ascii */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user