Xavier de Gaye added the comment: Android default system encoding is UTF-8 as specified at http://developer.android.com/reference/java/nio/charset/Charset.html
<quote>The platform's default charset is UTF-8. (This is in contrast to some older implementations, where the default charset depended on the user's locale.) </quote> > If the platform doesn't provide anything, we can maybe adopt the same > approach than Mac OS X: force the encoding to UTF-8 and just don't use > the C library. The attached patch does the same thing as proposed by Victor but emphasizes that Android does not HAVE_LANGINFO_H and does not have CODESET. And the fact that HAVE_LANGINFO_H and CODESET are not defined causes other problems (maybe as well in Mac OS X). In that case, PyCursesWindow_New() in _cursesmodule.c falls back nicely to "utf-8", but _Py_device_encoding() in fileutils.c instead does a Py_RETURN_NONE. It seems that this impacts _io_TextIOWrapper___init___impl() in textio.c and os_device_encoding_impl() in posixmodule.c. And indeed, os.device_encoding(0) returns None on android. ---------- nosy: +xdegaye Added file: http://bugs.python.org/file42585/locale.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22747> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com