fixed 'str' to 'wxString' converstation, when emoji is inside string (fixes #2446)

This commit is contained in:
timrid
2023-11-27 09:59:05 +01:00
committed by GitHub
parent 172e732a0c
commit 0dcd0640ca
3 changed files with 4 additions and 4 deletions

View File

@@ -59,7 +59,7 @@
}
PyErr_Clear();
wxString string;
size_t len = PyUnicode_GET_LENGTH(item);
size_t len = PyUnicode_AsWideChar(item, NULL, 0);
if (len) {
wxPyUnicode_AsWideChar(item, wxStringBuffer(string, len), len);
}

View File

@@ -45,7 +45,7 @@
}
}
*sipCppPtr = new wxString();
size_t len = PyUnicode_GET_LENGTH(uni);
size_t len = PyUnicode_AsWideChar(uni, NULL, 0);
if (len) {
wxPyUnicode_AsWideChar(uni, wxStringBuffer(**sipCppPtr, len), len);
}

View File

@@ -54,7 +54,7 @@ static wxString i_Py2wxString(PyObject* source)
}
}
wxString target;
size_t len = PyUnicode_GET_LENGTH(uni);
size_t len = PyUnicode_AsWideChar(uni, NULL, 0);
if (len) {
wxPyUnicode_AsWideChar(uni, wxStringBuffer(target, len), len);
}
@@ -84,7 +84,7 @@ static wxString i_Py2wxString(PyObject* source)
// }
// }
// // TODO: Coerce non-unicode types to unicode here? (Classic does)
// size_t len = PyUnicode_GET_LENGTH(uni);
// size_t len = PyUnicode_AsWideChar(uni, NULL, 0);
// if (len) {
// wxPyUnicode_AsWideChar(uni, wxStringBuffer(str, len), len);
// }