diff -r 38f5b3beeb2a Python/pythonrun.c --- a/Python/pythonrun.c Thu Mar 19 15:16:03 2015 -0500 +++ b/Python/pythonrun.c Thu Apr 09 10:23:03 2015 -0500 @@ -35,6 +35,47 @@ #include "windows.h" #endif +/* the following defines are from rjmatthews62@gmail.com, specifically from his + * notes on cross compiling Python for Android. In Android, mbstowcs is very broken + * the next lines define it here. + */ + +#ifdef __ANDROID__ +size_t android_mbstowcs(wchar_t *dest, char * in, int maxlen) { + wchar_t *out = dest; + int size = 0; + if (in) + { + while(*in && size= 0xdc800 && c <= 0xdcff) + { + /* UTF-8b surrogate */ + c-=0xdc800; + } + if (dest) dest[i]=c; + } + return i; +} +#endif + _Py_IDENTIFIER(builtins); _Py_IDENTIFIER(excepthook); _Py_IDENTIFIER(flush);