Results 1 to 2 of 2

Thread: read an xml file with Asian characters in QTextEdit

  1. #1
    Join Date
    Jan 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default read an xml file with Asian characters in QTextEdit

    hi, I need some help!

    I use QTextEdit to read an xml file with some Asian characters. But the characters are not displayed correctly.

    QTextStream in(&file);
    in.setCodec(QTextCodec::codecForName("GB2312"));
    QApplication::setOverrideCursor(Qt::WaitCursor);
    setPlainText(in.readAll());
    QApplication::restoreOverrideCursor();

    Did I use the qtextcodec right? Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: read an xml file with Asian characters in QTextEdit

    Yes but is it the right codec?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QTextEdit partial read-only
    By pckoster in forum Qt Programming
    Replies: 1
    Last Post: 13th December 2009, 13:12
  2. Reading characters in Binary file.....
    By umulingu in forum Qt Programming
    Replies: 2
    Last Post: 23rd July 2009, 05:51
  3. is qt phonon can read realmedia file and divx file
    By fayssalqt in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2009, 16:42
  4. Replies: 13
    Last Post: 10th October 2007, 16:38
  5. Replies: 4
    Last Post: 10th July 2007, 21:11

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.