Search code examples
qtutf-8utf-16qstring

Qt: Convertion of a QString from utf16 to utf8


i'm trying to convert some data get from a txt file coded in utf16 to utf8 by using Qt. Could someone help in this? Thank you in advance.


Solution

  • QString provides methods to import from UTF-16 and export to UTF-8, and vice versa of course, and many others. The QByteArray objects used for input/output of these methods are best handled by using QFile.

    You should be able to find your way from there; if you have other problems with using this facilities you're supposed to provide a Minimal, Complete, and Verifiable example in order to get appropriate help.