The problem has been solved by using QTextCodec::setCodecForCStrings.