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.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 9c998f7..4491167 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5083,10 +5083,10 @@
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 @@
return unicode;
}
-#endif /* __APPLE__ */
+#endif /* __APPLE__ or __ANDROID__ */
/* Primary internal function which creates utf8 encoded bytes objects.