diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-07 13:41:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-07 13:41:16 +0300 |
commit | 63fbd76548f0decb7fe2fc171bf083a21fa3e643 (patch) | |
tree | 9e3081492451cd9d17bd3b25e5cc3166784851ac /source/blender/python | |
parent | f888903eaf45b02a41b100b8ef758a9913102688 (diff) |
[#20021] Non-ASCII characters on blender 2.5 alpha 0
could not redo the bug on my system, fix suggested by Yomgui on blendercoders.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 9a14717b060..d4d0cbf602f 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -313,11 +313,25 @@ void BPY_start_python( int argc, char **argv ) /* sigh, why do python guys not have a char** version anymore? :( */ { int i; +#if 0 PyObject *py_argv= PyList_New(argc); - for (i=0; i<argc; i++) PyList_SET_ITEM(py_argv, i, PyUnicode_FromString(argv[i])); +#else // should fix bug #20021 - utf path name problems + PyObject *py_argv= PyList_New(0); + for (i=0; i<argc; i++) { + PyObject *item= PyUnicode_Decode(argv[i], strlen(argv[i]), Py_FileSystemDefaultEncoding, NULL); + if(item==NULL) { // should never happen + PyErr_Print(); + PyErr_Clear(); + } + else { + PyList_Append(py_argv, item); + Py_DECREF(item); + } + } +#endif PySys_SetObject("argv", py_argv); Py_DECREF(py_argv); } |