diff --git a/autotests/texthandlertest.cpp b/autotests/texthandlertest.cpp index 2d2eed630..88111d4ff 100644 --- a/autotests/texthandlertest.cpp +++ b/autotests/texthandlertest.cpp @@ -59,6 +59,8 @@ private Q_SLOTS: void receiveRichtextIn(); void receiveRichMxcUrl(); void receiveRichPlainUrl(); + + void receiveLineSeparator(); }; #ifdef QUOTIENT_07 @@ -498,5 +500,13 @@ void TextHandlerTest::receiveRichPlainUrl() QCOMPARE(testTextHandler.handleRecieveRichText(Qt::RichText), testOutputStringMxId); } +void TextHandlerTest::receiveLineSeparator() +{ + auto text = QStringLiteral("foo\u2028bar"); + TextHandler textHandler; + textHandler.setData(text); + QCOMPARE(textHandler.handleRecievePlainText(Qt::PlainText, true), QStringLiteral("foo bar")); +} + QTEST_MAIN(TextHandlerTest) #include "texthandlertest.moc" diff --git a/src/texthandler.cpp b/src/texthandler.cpp index 25a9f4eed..23a1dcaa6 100644 --- a/src/texthandler.cpp +++ b/src/texthandler.cpp @@ -169,6 +169,7 @@ QString TextHandler::handleRecievePlainText(Qt::TextFormat inputFormat, const bo m_dataBuffer.replace(QStringLiteral("
\n"), QStringLiteral(" ")); m_dataBuffer.replace(QStringLiteral("
"), QStringLiteral(" ")); m_dataBuffer.replace(u'\n', QStringLiteral(" ")); + m_dataBuffer.replace(u'\u2028', " "); } // Strip all tags/attributes except code blocks which will be escaped.