Problem with rendering the japanese and chinese language in html file using QTextStream
-
I have tried to create a report in Html formate based on the language input. For all language, it works as expected but for japanis and Chinese language.i'm seeing some unpredictable character in the HTML page. please I need some help on how to render these two languages using QTextStream.
here I have created one simple example to see the issue.#include <QCoreApplication>
#include <QFile>
#include <QTextStream>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);QFile data("log.html"); if (data.open(QFile::WriteOnly | QFile::Truncate)) { QTextStream stream(&data); QByteArray string = "形容動詞"; stream <<string; data.close(); } return a.exec();
}
o/p: ????
-
@msah said in Problem with rendring the japanis and chinese langugae in html file using Qtextstream:
QByteArray string = "形容動詞";
This is wrong. QTextStream is for QStrings, not QByteArray and I'm pretty sure this is not displayable at all. Also make sure that QTextStream is using the correct codec you're expecting.