37#define WX_DEFAULTENCODING_SIZE 64
44 PyObject* list = PyList_New( 0 );
46 for(
size_t i = 0; i < lst.GetCount(); i++ )
48 PyObject* pyStr = PyUnicode_FromString( lst[i].utf8_str() );
49 PyList_Append( list, pyStr );
59 bool must_unref_str =
false;
60 bool must_unref_obj =
false;
65 PyObject* uni_str = src;
68 if( !PyBytes_Check( src ) && !PyUnicode_Check( src ) )
70 obj = PyObject_Str( src );
72 must_unref_obj =
true;
74 if( PyErr_Occurred() )
78 if( PyBytes_Check( obj ) )
81 must_unref_str =
true;
83 if( PyErr_Occurred() )
87 size_t len = PyUnicode_GET_LENGTH( uni_str );
90 result =
From_UTF8( PyUnicode_AsUTF8( uni_str ) );
109 return PyUnicode_FromString( src.utf8_str() );
wxString From_UTF8(const char *cstring)
const char * wxGetDefaultPyEncoding()
void wxSetDefaultPyEncoding(const char *encoding)
#define WX_DEFAULTENCODING_SIZE
static char wxPythonEncoding[WX_DEFAULTENCODING_SIZE]
wxString Py2wxString(PyObject *src)
PyObject * wxArrayString2PyList(const wxArrayString &lst)
PyObject * wx2PyString(const wxString &src)