Efog
Efog

Reputation: 1179

QUrl: incorrect link

I have a link on Steam market listings:
http://steamcommunity.com/market/listings/730/%E2%98%85%20Gut%20Knife%20%7C%20Safari%20Mesh%20%28Battle-Scarred%29

Now I'm trying to do a get request using QNetworkAccessManager:

auto manager = new QNetworkAccessManager(this);
auto url = QUrl(link, QUrl::StrictMode);
auto request = QNetworkRequest(url);

manager->get(request);

But when I try to output my url, I get just this:

qDebug() << link << url;
"http://steamcommunity.com/market/listings/730/%E2%98%85%20Gut%20Knife%20%7C%20Safari%20Mesh%20%28Battle-Scarred%29"
QUrl ("") 

Using TolerantMode in QUrl I get just empty page after the query.
So, QUrl considers my link is incorrect. How should I do that query? Thanks.

Upvotes: 1

Views: 101

Answers (1)

ahmed
ahmed

Reputation: 5600

Try:

QUrl url = QUrl::fromEncoded(link.toUtf8());
qDebug() << url;

The output is:

QUrl( "http://steamcommunity.com/market/listings/730/★ Gut Knife | Safari Mesh (Battle-Scarred)" )  

Upvotes: 1

Related Questions