diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-01-31 14:30:20 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-02-03 14:58:00 +0100 |
commit | c29fac453f3eaac73b29eb0a66d130220d073fc6 (patch) | |
tree | d1b40d8007012f2f6b9ff72866ec567dfe629680 /src/gui/text/qtextmarkdownimporter.cpp | |
parent | 77e8023eaf671b3ce9eae16f9b84f8571f441828 (diff) |
Markdown importer: use Unicode decoding
Given we feed UTF-8 data into the importer, it must be able to cope
with Unicode. Build md4c with UTF-8 support, advertise it at
usage site, and change a couple of broken decodings.
Driveby: the textedit example used the wrong codec to decode
a Markdown file. While the Markdown spec doesn't deal with encodings,
using the default one for HTML is certainly wrong. Port the loading
of both markdown and plaintext to UTF-8, as that what _saving_
via QTextDocumentWriter would use by default.
Change-Id: I51c6214cfe45ebfc5a67a7366f7866a5328366ec
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui/text/qtextmarkdownimporter.cpp')
-rw-r--r-- | src/gui/text/qtextmarkdownimporter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp index 88965046ce..b6a275f59c 100644 --- a/src/gui/text/qtextmarkdownimporter.cpp +++ b/src/gui/text/qtextmarkdownimporter.cpp @@ -397,8 +397,8 @@ int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det) break; case MD_SPAN_A: { MD_SPAN_A_DETAIL *detail = static_cast<MD_SPAN_A_DETAIL *>(det); - QString url = QString::fromLatin1(detail->href.text, int(detail->href.size)); - QString title = QString::fromLatin1(detail->title.text, int(detail->title.size)); + QString url = QString::fromUtf8(detail->href.text, int(detail->href.size)); + QString title = QString::fromUtf8(detail->title.text, int(detail->title.size)); charFmt.setAnchorHref(url); charFmt.setAnchorNames(QStringList(title)); charFmt.setForeground(m_palette.link()); |