Skip to content

Commit

Permalink
remove some Unicode characters in text-based article view
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Dec 1, 2023
1 parent 1557bc9 commit ef3def4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ void TextBrowserViewer::loadMessages(const QList<Message>& messages, RootItem* r
// html_messages.m_html = html_messages.m_html.replace(exp_replace_wide_stuff, QSL("width=\"%1\"").arg(width() *
// 0.9));

// Replace too wide pictures.
QRegularExpressionMatch exp_match;
qsizetype match_offset = 0;
int acceptable_width = int(width() * 0.9);
Expand All @@ -209,6 +210,17 @@ void TextBrowserViewer::loadMessages(const QList<Message>& messages, RootItem* r
match_offset = exp_match.capturedEnd();
}

// Remove other characters which cannot be displayed properly.
static QRegularExpression exp_symbols("&#x1F[0-9A-F]{3};");

html_messages.m_html = html_messages.m_html.replace(exp_symbols, QString());

/*
#if !defined(NDEBUG)
IOFactory::writeFile("aaa.html", html_messages.m_html.toUtf8());
#endif
*/

setHtml(html_messages.m_html, html_messages.m_baseUrl);

QTextOption op;
Expand Down

0 comments on commit ef3def4

Please sign in to comment.