Skip to content

Commit

Permalink
Merge pull request #2488 from timrid/bugfix/str-to-wxstring-with-emoji
Browse files Browse the repository at this point in the history
fixed 'str' to 'wxString' converstation, when emoji is inside string
  • Loading branch information
swt2c authored Nov 28, 2023
2 parents 172e732 + 0dcd064 commit 20447e7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/arrays.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/string.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/wxpy_api.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
// }
Expand Down

0 comments on commit 20447e7

Please sign in to comment.