Version: 0.6 (using KDE 4.5.1) OS: Linux In some chinese web page, people would specify the encoding gb2312 in the meta of html, but the page actually use gb18030 as their encoding. This is just a case of Chinese local problem, but popular browser like firefox and chrome can handle this quite well. So would rekonq try to do some "hack" to fix this problem? Because such error in Chinese web page is quite common, we cannot expect every site to fix this by themself... Additional information: gb2312 and gb18030 is Downward Compatible, so it's safe to force all gb2312 page to use gb18030, and all popular browser seems to do this. Reproducible: Didn't try Steps to Reproduce: Open a web site like bilibili.us Actual Results: Encoding error in the webpage Expected Results: Web page is correctly displayed.
Sorry, I forget to choice the Reproducible option... It should be always.
I won't promise nothing, but I'll take a look and I'll see what is possible for 0.6.1.. Regards,
commit ed9d2b80aa3fa7a190a2be2989215935cdf09b8d Author: Andrea Diamantini <adjam7@gmail.com> Date: Wed Sep 29 17:02:39 2010 +0200 HACK: fix Chinese sites encoding, as suggested by Weng Xuetian in bug #251264 and by... Wikipedia!! ;) CCBUG: 251264 Xeng, does this fix your issue? diff --git a/src/webpage.cpp b/src/webpage.cpp index 07f961c..9be0d3c 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -207,6 +207,7 @@ WebPage::WebPage(QWidget *parent) // ----- last stuffs connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*))); + connect(this, SIGNAL(loadStarted()), this, SLOT(loadStarted())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); // protocol handler signals @@ -471,17 +472,29 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) } +void WebPage::loadStarted() +{ + // HACK: + // Chinese encoding Fix. See BUG: 251264 + // Use gb18030 instead of gb2312 + if(settings()->defaultTextEncoding() == QL1S("gb2312")) + { + settings()->setDefaultTextEncoding( QL1S("gb18030") ); + } +} + void WebPage::loadFinished(bool ok) { Q_UNUSED(ok); - Application::iconManager()->provideIcon(this, _loadingUrl); + // Provide site icon. Can this be moved to loadStarted?? + Application::iconManager()->provideIcon(this, _loadingUrl); + // Apply adblock manager hiding rules Application::adblockManager()->applyHidingRules(this); - QStringList list = ReKonfig::walletBlackList(); - // KWallet Integration + QStringList list = ReKonfig::walletBlackList(); if (wallet() && !list.contains(mainFrame()->url().toString()) ) diff --git a/src/webpage.h b/src/webpage.h index 5b79275..b6e0c53 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -58,7 +58,7 @@ public: inline bool isOnRekonqPage() const { return _isOnRekonqPage; }; inline void setIsOnRekonqPage(bool b) { _isOnRekonqPage = b; }; -public slots: +public Q_SLOTS: void downloadAllContentsWithKGet(QPoint); virtual void downloadRequest(const QNetworkRequest &request); @@ -71,9 +71,10 @@ protected: const QNetworkRequest &request, NavigationType type); -private slots: +private Q_SLOTS: void handleUnsupportedContent(QNetworkReply *reply); void manageNetworkErrors(QNetworkReply *reply); + void loadStarted(); void loadFinished(bool); void showSSLInfo(QPoint); void updateImage(bool ok);