Bogdan Cristea
2015-03-18 21:25:06 UTC
Hi
I am using boost python for providing python bindings for a C++ library. I am using Python 2.7. My library needs to call callbacks that are defined in Python. There callbacks can take a string parameter. C++ side I am always using std::wstring. Everything works on as long as std::wstring contains only ASCII chars, but once I get something like âéâ my application crashes. This issue seems to be related to the way I pass std::wstring to Python callbacks: as long as I make sure that the passed string has only ASCII chars it is ok. My problem is how do I pass unicode strings to Python.
thanks
Bogdan
I am using boost python for providing python bindings for a C++ library. I am using Python 2.7. My library needs to call callbacks that are defined in Python. There callbacks can take a string parameter. C++ side I am always using std::wstring. Everything works on as long as std::wstring contains only ASCII chars, but once I get something like âéâ my application crashes. This issue seems to be related to the way I pass std::wstring to Python callbacks: as long as I make sure that the passed string has only ASCII chars it is ok. My problem is how do I pass unicode strings to Python.
thanks
Bogdan