Results 1 to 3 of 3

Thread: Printing non-ascii characters.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Printing non-ascii characters.

    Quote Originally Posted by kikapu View Post
    while query.next():
    candidate = QtCore.QVariant.toString(query.value(0))
    print QtCore.QString.toUtf8(candidate)
    It should be:
    Python Code:
    1. while query.next():
    2. candidate = query.value(0).toString()
    3. print candidate.toUtf8()
    To copy to clipboard, switch view to plain text mode 
    but those strings will be displayed correctly only if your console uses UTF-8. You might try toAscii() or toLocal8Bit() instead.

  2. The following user says thank you to jacek for this useful post:

    kikapu (24th June 2007)

  3. #2
    Join Date
    May 2007
    Posts
    23
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3

    Default Re: Printing non-ascii characters.

    Quote Originally Posted by jacek View Post
    It should be:
    Python Code:
    1. while query.next():
    2. candidate = query.value(0).toString()
    3. print candidate.toUtf8()
    To copy to clipboard, switch view to plain text mode 
    Hmm...so, i correctly did not like that QVariant stuff, but i use Python as you already know so the back-and-forth of the C++ documentations is not every time so straightforward


    but those strings will be displayed correctly only if your console uses UTF-8. You might try toAscii() or toLocal8Bit() instead.
    Thanks a lot! That toLocal8Bit() did the trick! The Greek names are now correctly displayed to the Console Window.

    So, i already did a form by using the Qt Designer and i can display the same data to a listWidget.

    Thanks again!
    Software Engineer, riding a Kona King Kikapu 2007

Similar Threads

  1. Problem at time compilation in traslation of language
    By thomasjoy in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2007, 14:18

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
  •  
Qt is a trademark of The Qt Company.