diff --git a/examples/network/torrent/trackerclient.cpp b/examples/network/torrent/trackerclient.cpp index 077696ccd82..77a45770748 100644 --- a/examples/network/torrent/trackerclient.cpp +++ b/examples/network/torrent/trackerclient.cpp @@ -62,12 +62,8 @@ void TrackerClient::fetchPeerList() QUrlQuery query(url); // Percent encode the hash - QByteArray infoHash = torrentDownloader->infoHash(); - QByteArray encodedSum; - for (int i = 0; i < infoHash.size(); ++i) { - encodedSum += '%'; - encodedSum += QByteArray::number(infoHash[i], 16).right(2).rightJustified(2, '0'); - } + const QByteArray infoHash = torrentDownloader->infoHash(); + const QByteArray encodedSum = infoHash.toPercentEncoding(); bool seeding = (torrentDownloader->state() == TorrentClient::Seeding);