Results 1 to 3 of 3

Thread: codepage in PyQT textedit

  1. #1
    Join Date
    Apr 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default codepage in PyQT textedit

    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.
    PyQT cannot show this characters at all?

    1554816717(1).jpg
    1554816742(1).png
    Last edited by lipati; 9th April 2019 at 15:40. Reason: updated contents

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: codepage in PyQT textedit

    Have you checked if the currently used font contains these characters?

    Cheers,
    _

  3. #3
    Join Date
    Apr 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: codepage in PyQT textedit

    Quote Originally Posted by anda_skoa View Post
    Have you checked if the currently used font contains these characters?

    Cheers,
    _
    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.

Similar Threads

  1. Replies: 0
    Last Post: 4th November 2016, 00:27
  2. How to set the PlaceHolderText for a TextEdit?
    By JavidRoshan in forum Newbie
    Replies: 1
    Last Post: 20th November 2012, 00:56
  3. Qml TextEdit
    By goli in forum Newbie
    Replies: 4
    Last Post: 28th April 2011, 15:37
  4. textedit
    By limeir in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2010, 11:27
  5. Codepage 437
    By josepvr in forum Qt Programming
    Replies: 5
    Last Post: 2nd March 2009, 15:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.