add encoding parameter to .as_std_string()

to handle PyUnicode Objects. Usually ASCII for object names and Utf-8
for file names and console output.
issue #995
This commit is contained in:
Sebastian Hoogen
2015-01-31 22:36:39 +01:00
committed by wmayer
parent 8ee81e0516
commit faac8c36ba
8 changed files with 31 additions and 31 deletions

View File

@@ -71,11 +71,11 @@ void StartGuiExport initStartGui()
Py::Object o = Py::type(e);
if (o.isString()) {
Py::String s(o);
Base::Console().Error("%s\n", s.as_std_string().c_str());
Base::Console().Error("%s\n", s.as_std_string("utf-8").c_str());
}
else {
Py::String s(o.repr());
Base::Console().Error("%s\n", s.as_std_string().c_str());
Base::Console().Error("%s\n", s.as_std_string("utf-8").c_str());
}
// Prints message to console window if we are in interactive mode
PyErr_Print();