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
Bookmarks