diff --git a/autotests/texthandlertest.cpp b/autotests/texthandlertest.cpp
index 44c43e37b..d56e4c379 100644
--- a/autotests/texthandlertest.cpp
+++ b/autotests/texthandlertest.cpp
@@ -326,11 +326,19 @@ void TextHandlerTest::receivePlainTextIn()
const QString testOutputStringRich = QStringLiteral("<plain text in tag bracket>
Test link https://kde.org.");
QString testOutputStringPlain = QStringLiteral("\nTest link https://kde.org.");
+ // Make sure quotes are maintained in a plain string.
+ const QString testInputString2 = QStringLiteral("last line is \"Time to switch to a new topic.\"");
+ const QString testOutputString2 = QStringLiteral("last line is \"Time to switch to a new topic.\"");
+
TextHandler testTextHandler;
testTextHandler.setData(testInputString);
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::PlainText), testOutputStringRich);
QCOMPARE(testTextHandler.handleRecievePlainText(), testOutputStringPlain);
+
+ testTextHandler.setData(testInputString2);
+ QCOMPARE(testTextHandler.handleRecieveRichText(Qt::PlainText), testOutputString2);
+ QCOMPARE(testTextHandler.handleRecievePlainText(), testOutputString2);
}
void TextHandlerTest::receiveStripNewlines()
diff --git a/src/texthandler.cpp b/src/texthandler.cpp
index f6e6ff8a2..102116f72 100644
--- a/src/texthandler.cpp
+++ b/src/texthandler.cpp
@@ -371,6 +371,7 @@ QString TextHandler::unescapeHtml(QString stringIn)
stringIn.replace(QStringLiteral("<"), QStringLiteral("<"));
stringIn.replace(QStringLiteral(">"), QStringLiteral(">"));
stringIn.replace(QStringLiteral("&"), QStringLiteral("&"));
+ stringIn.replace(QStringLiteral("""), QStringLiteral("\""));
return stringIn;
}