On 10 Feb 2009, at 17:15, William Newbery wrote:
I take it that Py_UNICODE is 4 on your platform.
You could try encode('utf-16') to get a Py::String that is in utf-16.
Then use as_std_string() to get a std:string, use c_str() to get a pointer to the contents and cast it to wchar_t.
Adding a as_std_wstring would be a reasonable thing to add to PyCXX to make this convenient.
as_std_wstring could look inside the Py_Object and avoid a number of conversion steps.