diff -r 1927f47a1838 Modules/main.c
--- a/Modules/main.c	Wed Jul 30 19:24:32 2014 -0400
+++ b/Modules/main.c	Fri Aug 01 14:15:50 2014 +0200
@@ -540,7 +540,7 @@ Py_Main(int argc, wchar_t **argv)
         oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
         setlocale(LC_ALL, "");
         for (p = strtok(buf, ","); p != NULL; p = strtok(NULL, ",")) {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__ANDROID__)
             /* Use utf-8 on Mac OS X */
             unicode = PyUnicode_FromString(p);
 #else
diff -r 1927f47a1838 Objects/unicodeobject.c
--- a/Objects/unicodeobject.c	Wed Jul 30 19:24:32 2014 -0400
+++ b/Objects/unicodeobject.c	Fri Aug 01 14:15:50 2014 +0200
@@ -3205,13 +3205,22 @@ wcstombs_errorpos(const wchar_t *wstr)
 static int
 locale_error_handler(const char *errors, int *surrogateescape)
 {
+
     if (errors == NULL) {
+#ifdef __ANDROID__
+        *surrogateescape = 1;
+#else
         *surrogateescape = 0;
+#endif
         return 0;
     }
 
     if (strcmp(errors, "strict") == 0) {
+#ifdef __ANDROID__
+        *surrogateescape = 1;
+#else
         *surrogateescape = 0;
+#endif
         return 0;
     }
     if (strcmp(errors, "surrogateescape") == 0) {
@@ -3340,7 +3349,7 @@ PyUnicode_EncodeFSDefault(PyObject *unic
 {
 #ifdef HAVE_MBCS
     return PyUnicode_EncodeCodePage(CP_ACP, unicode, NULL);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__ANDROID__)
     return _PyUnicode_AsUTF8String(unicode, "surrogateescape");
 #else
     PyInterpreterState *interp = PyThreadState_GET()->interp;
@@ -3626,7 +3635,7 @@ PyUnicode_DecodeFSDefaultAndSize(const c
 {
 #ifdef HAVE_MBCS
     return PyUnicode_DecodeMBCS(s, size, NULL);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__ANDROID__)
     return PyUnicode_DecodeUTF8Stateful(s, size, "surrogateescape", NULL);
 #else
     PyInterpreterState *interp = PyThreadState_GET()->interp;
@@ -4811,7 +4820,7 @@ onError:
     return NULL;
 }
 
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__ANDROID__)
 
 /* Simplified UTF-8 decoder using surrogateescape error handler,
    used to decode the command line arguments on Mac OS X.
diff -r 1927f47a1838 Python/bltinmodule.c
--- a/Python/bltinmodule.c	Wed Jul 30 19:24:32 2014 -0400
+++ b/Python/bltinmodule.c	Fri Aug 01 14:15:50 2014 +0200
@@ -24,7 +24,7 @@
 #ifdef HAVE_MBCS
 const char *Py_FileSystemDefaultEncoding = "mbcs";
 int Py_HasFileSystemDefaultEncoding = 1;
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__ANDROID__)
 const char *Py_FileSystemDefaultEncoding = "utf-8";
 int Py_HasFileSystemDefaultEncoding = 1;
 #else
diff -r 1927f47a1838 Python/fileutils.c
--- a/Python/fileutils.c	Wed Jul 30 19:24:32 2014 -0400
+++ b/Python/fileutils.c	Fri Aug 01 14:15:50 2014 +0200
@@ -18,7 +18,7 @@
 #include <fcntl.h>
 #endif /* HAVE_FCNTL_H */
 
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__ANDROID__)
 extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
 #endif
 
@@ -63,7 +63,7 @@ PyObject *
     Py_RETURN_NONE;
 }
 
-#if !defined(__APPLE__) && !defined(MS_WINDOWS)
+#if !defined(__APPLE__) && !defined(__ANDROID__) && !defined(MS_WINDOWS)
 extern int _Py_normalize_encoding(const char *, char *, size_t);
 
 /* Workaround FreeBSD and OpenIndiana locale encoding issue with the C locale.
@@ -213,7 +213,7 @@ encode_ascii_surrogateescape(const wchar
 }
 #endif   /* !defined(__APPLE__) && !defined(MS_WINDOWS) */
 
-#if !defined(__APPLE__) && (!defined(MS_WINDOWS) || !defined(HAVE_MBRTOWC))
+#if !defined(__APPLE__) && !defined(__ANDROID__) && (!defined(MS_WINDOWS) || !defined(HAVE_MBRTOWC))
 static wchar_t*
 decode_ascii_surrogateescape(const char *arg, size_t *size)
 {
@@ -260,7 +260,7 @@ decode_ascii_surrogateescape(const char 
 wchar_t*
 _Py_char2wchar(const char* arg, size_t *size)
 {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__ANDROID__)
     wchar_t *wstr;
     wstr = _Py_DecodeUTF8_surrogateescape(arg, strlen(arg));
     if (size != NULL) {
@@ -403,7 +403,7 @@ oom:
 char*
 _Py_wchar2char(const wchar_t *text, size_t *error_pos)
 {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__ANDROID__)
     Py_ssize_t len;
     PyObject *unicode, *bytes = NULL;
     char *cpath;
