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

lizhao0512 at 126.com lizhao0512 at 126.com
Mon Mar 4 13:18:44 GMT 2024


But the code works well for PyQT5, no such exceptions with PyQt5




--

Sincerely,
Zhao Li





At 2024-03-04 17:15:24, "Phil Thompson" <phil at riverbankcomputing.com> wrote:
>On 04/03/2024 02:30, lizhao0512 at 126.com wrote:
>> After converting the ConfigWindow.ui to Ui_ConfigWindow.py, and then
>> run ConfigWindow-test.py with it, I got the following error. Test
>> files are attached.
>> 
>> Traceback (most recent call last):
>>   File
>> "F:\BaiduNetdiskDownload\SoftwareProject\LYYDownloader-dev\ConfigWindow.py",
>> line 64, in <module>
>>     ui = ConfigWindow()
>>   File
>> "F:\BaiduNetdiskDownload\SoftwareProject\LYYDownloader-dev\ConfigWindow.py",
>> line 27, in __init__
>>     self.setupUi(self)
>>   File
>> "F:\BaiduNetdiskDownload\SoftwareProject\LYYDownloader-dev\Ui_ConfigWindow.py",
>> line 179, in setupUi
>>     self.retranslateUi(Dialog)
>>   File
>> "F:\BaiduNetdiskDownload\SoftwareProject\LYYDownloader-dev\Ui_ConfigWindow.py",
>> line 211, in retranslateUi
>>     self.label.setText(QCoreApplication.translate("Dialog", "<!DOCTYPE
>> HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"
>> \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
>> UnicodeEncodeError: 'utf-8' codec can't encode characters in position
>> 1047-1048: surrogates not allowed
>
>Assuming the text really is utf-8 then I think that is a Python 
>limitation.
>
>Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20240304/e7519c4e/attachment.htm>


More information about the PyQt mailing list