How to print html with cyrillic symbols?
I tried to do this:
QTextDocument *document = new QTextDocument();
document->setHtml(htmlContent);
document->print(printer);
But document printed in wrong encoding. Html encoding is utf-8.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming htmlContent is QString, you probably created it with wrong encoding. For example, if original HTML data (which is bytes) is UTF-8, then you should maybe use something like
htmlContent = QString::fromUtf8(myHtmlDataCharPtr);If htmlContent is char pointer to UTF-8 data, then you should use
document->setHtml(QString::fromUtf8(htmlContent));