Results 1 to 6 of 6

Thread: convert QString to QByteArray

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Posts
    9
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default convert QString to QByteArray

    Hello Qt users.

    I got trouble in convert QString to QByteArray.

    I got Korean PlainText from textEdit.
    it stored in QString.
    So when i print QString the value is correct value.

    But QByteArray value from The QString value is incorrect.

    What i missed?(OS: Kubuntu(utf8))

    Qt Code:
    1. QString memo_text=textEdit.toPlainText();
    2. qDebug()<<memo_text; //Korean String value correct;
    3. QByteArray textTemp(memo_text.toUtf8() ,1000);
    4. qDebug()<<memo_text; //Korean String value incorrect;
    5. strcpy(memo_info->text , textTemp.data());
    6. qDebug()<<memo_text; //Korean String value incorrect;
    To copy to clipboard, switch view to plain text mode 
    Last edited by morgana; 28th July 2008 at 08:57.

Similar Threads

  1. Read binary file and convert to QString
    By jaca in forum Qt Programming
    Replies: 12
    Last Post: 13th June 2008, 23:05
  2. convert QString to int
    By mattia in forum Newbie
    Replies: 2
    Last Post: 4th January 2008, 09:10
  3. QByteArray to QString
    By babu198649 in forum Newbie
    Replies: 7
    Last Post: 6th December 2007, 13:08
  4. how to convert int to QString?
    By phillip_Qt in forum Newbie
    Replies: 2
    Last Post: 5th October 2007, 08:07
  5. How to convert from QString to quint16 ?
    By probine in forum Qt Programming
    Replies: 5
    Last Post: 31st March 2006, 09:00

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.