Results 1 to 4 of 4

Thread: UTF8 to ISO 8859... conversion

Threaded View

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

    Default Re: UTF8 to ISO 8859... conversion

    Quote Originally Posted by claudio View Post
    So how can I convert the QString 'fs' - wich is already in UTF8 - to an other QString with an other encoding? Sorry for this newbie question...
    You can't. QString can be only in UTF-16. However you can use whatever encoding you like while writing it to a file/stream/QByteArray.

    When you read something from a file using QTextStream, you have to tell QTextStream which codec to use (if you don't like the default one) and in return you will get QStrings in UTF-16. Then you can write them to another file using different QTextStream with a different codec.

    The proper workflow in Qt is:

    file -> codec -> QString -> codec -> file

    not:

    file -> QString -> codec -> QString -> file

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

    claudio (30th December 2007)

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.