Results 1 to 20 of 29

Thread: How to write a Russian text in console?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2012
    Posts
    232
    Thanks
    118
    Thanked 18 Times in 10 Posts
    Platforms
    Windows Android

    Default How to write a Russian text in console?

    Hi,

    How to write a Russian text in console?

    This is my code:

    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QDebug>
    3. #include <QTextCodec>
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QCoreApplication a(argc, argv);
    8.  
    9. QTextCodec *russian =QTextCodec::codecForName("CP1251");
    10. QTextCodec::setCodecForTr(russian);
    11. qDebug() << QObject::tr("Привет Мир");
    12.  
    13. return a.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

    Output:
    "╨Я╤А╨╕╨■“╨╡╤В ╨Ь╨╕╤А"
    Thank you!

  2. The following 2 users say thank you to 8Observer8 for this useful post:


Similar Threads

  1. Qt Linguist Can't write in russian in the translation field
    By mirluk in forum Qt Tools
    Replies: 1
    Last Post: 27th June 2012, 09:44
  2. Read/Write console app
    By InterFiction in forum Newbie
    Replies: 1
    Last Post: 15th November 2011, 14:00
  3. Replies: 7
    Last Post: 13th September 2011, 13:15
  4. How to write qt4 gui up to the existing console
    By binaural in forum Qt Programming
    Replies: 4
    Last Post: 16th June 2009, 13:44
  5. Console text color
    By skyphyr in forum Qt Programming
    Replies: 4
    Last Post: 11th December 2006, 17:19

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.