Skip to content
Permalink
Browse files

Fix UTF-8 handling on UPnP request URLs

Patch from Ticket 9188

Changes UPnP searches, etc to use UTF-8 rather than Latin1.
  • Loading branch information
David Kubicek authored and Beirdo committed Dec 20, 2010
1 parent 9abf29a commit 56dab8455ee03a75e3ec693854bebb44da0cbff0
@@ -852,8 +852,8 @@ long HTTPRequest::GetParameters( QString sParams, QStringMap &mapParams )

if ((sName.length() != 0) && (sValue.length() !=0))
{
sName = QUrl::fromPercentEncoding(sName.toLatin1());
sValue = QUrl::fromPercentEncoding(sValue.toLatin1());
sName = QUrl::fromPercentEncoding(sName.toUtf8());
sValue = QUrl::fromPercentEncoding(sValue.toUtf8());

mapParams.insert( sName.trimmed(), sValue );
nCount++;
@@ -1093,12 +1093,12 @@ void HTTPRequest::ProcessRequestLine( const QString &sLine )
if (nCount > 1)
{
//m_sBaseUrl = tokens[1].section( '?', 0, 0).trimmed();
m_sBaseUrl = (QUrl::fromPercentEncoding(tokens[1].toLatin1())).section( '?', 0, 0).trimmed();
m_sBaseUrl = (QUrl::fromPercentEncoding(tokens[1].toUtf8())).section( '?', 0, 0).trimmed();

// Process any Query String Parameters

//QString sQueryStr = tokens[1].section( '?', 1, 1 );
QString sQueryStr = (QUrl::fromPercentEncoding(tokens[1].toLatin1())).section( '?', 1, 1 );
QString sQueryStr = (QUrl::fromPercentEncoding(tokens[1].toUtf8())).section( '?', 1, 1 );

if (sQueryStr.length() > 0)
GetParameters( sQueryStr, m_mapParams );
@@ -1307,8 +1307,8 @@ bool HTTPRequest::ProcessSOAPPayload( const QString &sSOAPAction )
if (!oText.isNull())
sValue = oText.nodeValue();

sName = QUrl::fromPercentEncoding(sName.toLatin1());
sValue = QUrl::fromPercentEncoding(sValue.toLatin1());
sName = QUrl::fromPercentEncoding(sName.toUtf8());
sValue = QUrl::fromPercentEncoding(sValue.toUtf8());

m_mapParams.insert( sName.trimmed(), sValue );
}
@@ -139,7 +139,7 @@ QString SOAPClient::GetNodeValue( QDomNode &node, const QString &sName, const QS
if (!oText.isNull())
sValue = oText.nodeValue();

return QUrl::fromPercentEncoding(sValue.toLatin1());
return QUrl::fromPercentEncoding(sValue.toUtf8());
}

return sDefault;
@@ -261,8 +261,8 @@ bool SOAPClient::SendSOAPRequest( const QString &sMethod,
if (!oText.isNull())
sValue = oText.nodeValue();

list.insert(QUrl::fromPercentEncoding(sName.toLatin1()),
QUrl::fromPercentEncoding(sValue.toLatin1()));
list.insert(QUrl::fromPercentEncoding(sName.toUtf8()),
QUrl::fromPercentEncoding(sValue.toUtf8()));
}
}
}
@@ -994,7 +994,7 @@ UPnpCDSExtensionResults *UPnpCDSExtension::ProcessKey( UPnpCDSRequest *
// ----------------------------------------------------------------------

QString sKey = idPath.last().section( '=', 1, 1 );
sKey = QUrl::fromPercentEncoding(sKey.toLatin1());
sKey = QUrl::fromPercentEncoding(sKey.toUtf8());

if (sKey.length() > 0)
{
@@ -128,7 +128,7 @@ QString CDSObject::GetPropValue(const QString &sName) const
Properties::const_iterator it = m_properties.find(sName);

if (it != m_properties.end() && *it)
return QUrl::fromPercentEncoding((*it)->m_sValue.toLatin1());
return QUrl::fromPercentEncoding((*it)->m_sValue.toUtf8());

return "";
}

0 comments on commit 56dab84

Please sign in to comment.
You can’t perform that action at this time.