Skip to content

Commit

Permalink
Fix UTF-8 handling on UPnP request URLs
Browse files Browse the repository at this point in the history
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 b769303 commit 1ef81e1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions mythtv/libs/libmythupnp/httprequest.cpp
Expand Up @@ -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++;
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
}
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythupnp/soapclient.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythupnp/upnpcds.cpp
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythupnp/upnpcdsobjects.cpp
Expand Up @@ -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 "";
}
Expand Down

0 comments on commit 1ef81e1

Please sign in to comment.