Treat returned content as Utf8 since that is what we requested to recieve

in the first place.

BUG: 266808
FIXED-IN: 4.6.5

(cherry picked from commit a1aee333be)
This commit is contained in:
Dawit Alemayehu 2011-06-10 18:33:01 -04:00
parent 9f66e3d209
commit 4648cc1b31

View file

@ -21,6 +21,9 @@
#include "OpenSearchEngine.h"
#include <KDE/KGlobal>
#include <KDE/KLocale>
#include <QtCore/QRegExp>
#include <QtCore/QStringList>
#include <QtScript/QScriptEngine>
@ -42,12 +45,10 @@ QString OpenSearchEngine::parseTemplate(const QString &searchTerm, const QString
result.replace(QLatin1String("{count}"), QLatin1String("20"));
result.replace(QLatin1String("{startIndex}"), QLatin1String("0"));
result.replace(QLatin1String("{startPage}"), QLatin1String("0"));
// TODO - get setting from KDE
result.replace(QLatin1String("{language}"), QLatin1String("en-US"));
result.replace(QLatin1String("{language}"), KGlobal::locale()->language());
result.replace(QLatin1String("{inputEncoding}"), QLatin1String("UTF-8"));
result.replace(QLatin1String("{outputEncoding}"), QLatin1String("UTF-8"));
result.replace(QLatin1String("{searchTerms}"), searchTerm);
return result;
}
@ -193,8 +194,7 @@ bool OpenSearchEngine::operator<(const OpenSearchEngine &other) const
QStringList OpenSearchEngine::parseSuggestion(const QByteArray &resp)
{
QString response(resp);
response = response.trimmed();
const QString response = QString::fromUtf8(resp.constData(), resp.size()).trimmed();
if (response.isEmpty()) {
return QStringList();