Commit 8f9f8d69 authored by Wolfgang Bauer's avatar Wolfgang Bauer

Fix specifying the charset when exporting as HTML

The QString::replace() had no effect because the stream actually
contains <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">, not just <!DOCTYPE html>.

Also, the <meta> tag should be inside the <head> section.

BUG: 374260
FIXED-IN: 17.08.0
Differential Revision: https://phabricator.kde.org/D7206
parent adafa317
...@@ -73,7 +73,7 @@ void WebEngineExportHtmlPageJob::slotSaveHtmlToPage(const QString &text) ...@@ -73,7 +73,7 @@ void WebEngineExportHtmlPageJob::slotSaveHtmlToPage(const QString &text)
QTextStream stream(&temporaryFile); QTextStream stream(&temporaryFile);
stream.setCodec("UTF-8"); stream.setCodec("UTF-8");
QString newText = text; QString newText = text;
newText.replace(QStringLiteral("<!DOCTYPE html>"), QStringLiteral("<!DOCTYPE html><meta charset=\"UTF-8\">")); newText.replace(QStringLiteral("<head>"), QStringLiteral("<head><meta charset=\"UTF-8\">"));
stream << newText; stream << newText;
temporaryFile.close(); temporaryFile.close();
//We need to remove this temporary file //We need to remove this temporary file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment