summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorXavier de Gaye <xdegaye@users.sourceforge.net>2016-12-15 20:59:58 +0100
committerXavier de Gaye <xdegaye@users.sourceforge.net>2016-12-15 20:59:58 +0100
commit76febd079299d64abffee0bdd7c4c1785e5a0fa7 (patch)
tree517048da532d163551a4a349ad3b8f0e1e5514d8 /Objects/unicodeobject.c
parent3d3f264849580ab1e8f3a8e8e8ba402bfe2c6523 (diff)
downloadcpython-git-76febd079299d64abffee0bdd7c4c1785e5a0fa7.tar.gz
Issue #26919: On Android, operating system data is now always encoded/decoded
to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 9c998f7ab3..44911671a0 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5083,10 +5083,10 @@ 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.
+ used to decode the command line arguments on Mac OS X and Android.
Return a pointer to a newly allocated wide character string (use
PyMem_RawFree() to free the memory), or NULL on memory allocation error. */
@@ -5137,7 +5137,7 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size)
return unicode;
}
-#endif /* __APPLE__ */
+#endif /* __APPLE__ or __ANDROID__ */
/* Primary internal function which creates utf8 encoded bytes objects.