diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-04-07 10:49:17 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-04-21 15:46:36 +0200 |
commit | 50916edd9d1707774c597abe1b7237e1a798fc53 (patch) | |
tree | ba761a0d1f017836fb1957212a63ff9854bce76c /src/gui/text/qtextdocumentfragment.cpp | |
parent | a23cb5cd06bcc3268387cb1abaa0dc2c2d3b13f4 (diff) |
Always encode HTML as utf-8
When converting a text document to HTML, always convert it to utf-8,
as required by the HTML standard. This also means that we remove
the optional encoding parameter.
Change-Id: I0bd2fc9df2d06734e1c5b8053b964fbfbb6881e1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/text/qtextdocumentfragment.cpp')
-rw-r--r-- | src/gui/text/qtextdocumentfragment.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 96d690fda4..6ea13f176f 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -376,17 +376,16 @@ QString QTextDocumentFragment::toPlainText() const /*! \since 4.2 - Returns the contents of the document fragment as HTML, - using the specified \a encoding (e.g., "UTF-8", "ISO 8859-1"). + Returns the contents of the document fragment as HTML. - \sa toPlainText(), QTextDocument::toHtml(), QTextCodec + \sa toPlainText(), QTextDocument::toHtml() */ -QString QTextDocumentFragment::toHtml(const QByteArray &encoding) const +QString QTextDocumentFragment::toHtml() const { if (!d) return QString(); - return QTextHtmlExporter(d->doc).toHtml(encoding, QTextHtmlExporter::ExportFragment); + return QTextHtmlExporter(d->doc).toHtml(QTextHtmlExporter::ExportFragment); } #endif // QT_NO_TEXTHTMLPARSER @@ -1268,12 +1267,6 @@ void QTextHtmlImporter::appendBlock(const QTextBlockFormat &format, QTextCharFor */ #ifndef QT_NO_TEXTHTMLPARSER - -QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &html) -{ - return fromHtml(html, nullptr); -} - /*! \fn QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &text, const QTextDocument *resourceProvider) \since 4.2 |