As we've already mentioned, QString has convenient methods for decoding and encoding data in the most popular encodings, such as UTF-8, UTF-16, and Latin1. However, Qt knows how to handle many other encodings as well. You can access them using the QTextCodec class. For example, if you have a file in Big-5 encoding, you can ask Qt for a codec object by its name and make use of the fromUnicode() and toUnicode() methods:
QByteArray big5Encoded = big5EncodedFile.readAll(); QTextCodec *big5Codec = QTextCodec::codecForName("Big5"); QString text = big5Codec->toUnicode(big5Encoded); QByteArray big5EncodedBack = big5Codec->fromUnicode(text);