issue #1027 use unicode filepaths
This commit is contained in:
@@ -180,12 +180,14 @@ PyObject* Application::sLoadFile(PyObject * /*self*/, PyObject *args,PyObject *
|
||||
|
||||
PyObject* Application::sOpenDocument(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
|
||||
{
|
||||
char *pstr;
|
||||
if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
char* Name;
|
||||
if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
|
||||
return NULL;
|
||||
std::string EncodedName = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
try {
|
||||
// return new document
|
||||
return (GetApplication().openDocument(pstr)->getPyObject());
|
||||
return (GetApplication().openDocument(EncodedName.c_str())->getPyObject());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_IOError, e.what());
|
||||
@@ -193,7 +195,7 @@ PyObject* Application::sOpenDocument(PyObject * /*self*/, PyObject *args,PyObjec
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
// might be subclass from zipios
|
||||
PyErr_Format(PyExc_IOError, "Invalid project file %s: %s\n", pstr, e.what());
|
||||
PyErr_Format(PyExc_IOError, "Invalid project file %s: %s\n", EncodedName.c_str(), e.what());
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user