Converted ui file throws UnicodeEncodeError: 'utf-8' codec can't encode characters in position 1047-1048: surrogates not allowed

Zhao Lee lizhao0512 at 126.com
Tue Mar 5 01:21:47 GMT 2024


So is it a bug with Qt, PyQt, or Python?

The PyQT5 version works well, but not PyQt6. 

--

Sincerely,
Zhao Li




At 2024-03-05 02:25:04, "Ben Rudiak-Gould" <benrudiak at gmail.com> wrote:

The problem is that U+1F427 (F0 9F 90 A7) in the source is being converted to \ud83d\udc27 in the string literal when it should be \U0001f427 (or F0 9F 90 A7 since the file encoding is UTF-8 anyway). That would have worked in earlier Python versions on platforms where wchar_t is 2 bytes, but current versions use UTF-32 internally.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20240305/eaffe5c7/attachment-0001.htm>


More information about the PyQt mailing list