From: Bob R. <bo...@br...> - 2012-03-21 01:10:23
|
Hi, In general, I love that std::string converts to a unicode string in python. However, sometimes this is WRONG. I've got an std::string that has arbitrary data in it. It is converted in swig through this call chain: - resultobj = SWIG_From_std_string(static_cast<std::string>(*result)); - return SWIG_FromCharPtrAndSize(s.data(), s.size()); - #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromStringAndSize(carray, static_cast< int >(size)); #else return PyString_FromStringAndSize(carray, static_cast< int >(size)); #endif The problem is, in my case, with arbitrary data, this is a hard error in python. Since the utf8 encoding/decoding fails. Is there a nice way to disable this and simply convert to a python string for a particular std::string member? Thanks, Bob |