=== modified file 'Modules/_localemodule.c' --- Modules/_localemodule.c 2012-10-08 10:20:38 +0000 +++ Modules/_localemodule.c 2012-10-08 10:21:44 +0000 @@ -149,6 +149,12 @@ PyErr_SetString(Error, "unsupported locale setting"); return NULL; } + + // reinit default fs encoding, see LP: #1058038 + char *codeset = get_codeset(); + if (codeset) + Py_FileSystemDefaultEncoding = codeset; + result_object = str2uni(result); if (!result_object) return NULL; === modified file 'Python/pythonrun.c' --- Python/pythonrun.c 2012-10-08 10:20:38 +0000 +++ Python/pythonrun.c 2012-10-08 10:25:52 +0000 @@ -167,7 +167,7 @@ } #if defined(HAVE_LANGINFO_H) && defined(CODESET) -static char* +char* get_codeset(void) { char* codeset = nl_langinfo(CODESET);