From 63f335fec6d3f28ca2676149285de2345609f027 Mon Sep 17 00:00:00 2001 From: YiFang Xiao Date: Sun, 9 Jul 2023 11:24:28 +0800 Subject: [PATCH] fix: qt5 website output response as text/plain fix #941 --- src/iframeschemehandler.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/iframeschemehandler.cc b/src/iframeschemehandler.cc index 9997f98e..753dd607 100644 --- a/src/iframeschemehandler.cc +++ b/src/iframeschemehandler.cc @@ -92,7 +92,15 @@ void IframeSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob) buffer->setData(articleString.toUtf8()); +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) requestJob->reply( "text/html; charset=utf-8", buffer ); +#else + #if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) + requestJob->reply( contentType, buffer ); + #else + requestJob->reply( "text/html", buffer ); + #endif +#endif }; connect( reply, &QNetworkReply::finished, requestJob, finishAction );