New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'str' to 'wxString' converstation is broken, when emoji is inside string #2446
Comments
This comment was marked as outdated.
This comment was marked as outdated.
Thanks @timrid for the bug report and analysis. I had feared that I'll try to take a look. |
I also looked at the Python C API. The docs are not so useful. But when i looked in the cpython code i saw this comment for /* Convert a Unicode object to a wide character string.
- If w is NULL: return the number of wide characters (including the null
character) required to convert the unicode object. Ignore size argument.
- Otherwise: return the number of wide characters (excluding the null
character) written into w. Write at most size wide characters (including
the null character). */
Py_ssize_t
PyUnicode_AsWideChar(PyObject *unicode,
wchar_t *w,
Py_ssize_t size)
{
... So i guess that size_t len = PyUnicode_GET_SIZE(uni); can be replaced with size_t len = PyUnicode_AsWideChar(uni, NULL, 0); |
Fixes #15714 See also nvaccess/nvda-misc-deps#32 Summary of the issue: wxPython introduced a bug in 4.2.1: wxWidgets/Phoenix#2446 This caused #15714 wxPython is yet to release the commit which fixes this issue. However, an alpha build wheel can be incorporate The build used is from: - https://alldunn.visualstudio.com/wxPython-CI/_build/results?buildId=1246&view=results - wxWidgets/Phoenix@0205c7c Description of user facing changes Emojis and other unicode symbols are displayed properly in NVDA Description of development approach Update wxPython to an alpha snapshot
Fixes nvaccess#15714 See also nvaccess/nvda-misc-deps#32 Summary of the issue: wxPython introduced a bug in 4.2.1: wxWidgets/Phoenix#2446 This caused nvaccess#15714 wxPython is yet to release the commit which fixes this issue. However, an alpha build wheel can be incorporate The build used is from: - https://alldunn.visualstudio.com/wxPython-CI/_build/results?buildId=1246&view=results - wxWidgets/Phoenix@0205c7c Description of user facing changes Emojis and other unicode symbols are displayed properly in NVDA Description of development approach Update wxPython to an alpha snapshot
Operating system: Windows 10
wxPython version & source: wxPython 4.2.1 from pypi
Python version & source: Python 3.11
Description of the problem:
Whem some special emojis like 🔄 are inside a python string, that is converted to an wxString (internally in wxPython), the last character of the string is lost. It is also not shown in the gui.
The changes in 29520a1 creates the problem. I compiled it with and without the changes and only with the changes the error occures. I guess that
PyUnicode_GET_LENGTH
is not an 1:1 replacement forPyUnicode_GET_SIZE
.I created the following small example to illustrate the problem.
The text was updated successfully, but these errors were encountered: