Solved PyQt5 textedit codepage
-
position_list, result_list = get_one_image_result(self.file_name[0][self.curFileIndex])
#print(result_list)
strResult = self.dealRecogResultList(result_list)
f = open(self.file_name[0][self.curFileIndex] + '.txt', 'w', encoding="utf-8")
f.write(strResult)
#outText = strResult.decode('utf-8')
self.plainTextEdit_result.insertPlainText(strResul t)It's a application for windows desktop, i use a textedit to display some Chinese minority language characters, like:??????????????????????????.
But it only displays some small black pieces.Even I use ctrl+C and ctrl+V to copy some characters from notepad to textedit, it displays the same small black pieces.
PyQt5 cannot show this characters at all?
-
Hi and welcome to devnet,
Are you using a font that supports these characters ?
-
@SGaist
Thank for your reply. The problem is solved.
It's my fault, i tried wrong font: self.setFont(QFont("宋体", 12))
This font can display the characters correctly in notepad, but I realized this font does not support this character(the windows system is processed adaptively).
So I download proprietary font and set it: self.plainTextEdit_result.setFont(QFont("hope", 12))
and the problem is solved. -
Glad you found a solution and thanks for sharing it.
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)