This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients Arfrever, WanderingLogic, lemburg, loewis, pitrou, skrah, vstinner, xdegaye
Date 2016-04-25.08:03:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461571386.2.0.595483616095.issue22747@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-04-25 08:03:06xdegayesetrecipients: + xdegaye, lemburg, loewis, pitrou, vstinner, Arfrever, skrah, WanderingLogic
2016-04-25 08:03:06xdegayesetmessageid: <1461571386.2.0.595483616095.issue22747@psf.upfronthosting.co.za>
2016-04-25 08:03:06xdegayelinkissue22747 messages
2016-04-25 08:03:06xdegayecreate