为何QNetworkAccessManager返回的结果与浏览器返回的结果不一致?
我用QNetworkAccessManager的get方法返回以下网址
http://keyword.discuz.com/related_kw.html?ics=gbk&ocs=gbk&title=%CA%B5%D3%C3%B5%C4%C3%E2%B7%D1%D6%D0%CE%C4%B7%D6%B4%CA%B7%FE%CE%F1
QNetworkAccessManager *acc=new QNetworkAccessManager(this);
......
acc->get(QNetworkRequest(QUrl("http://keyword.discuz.com/related_kw.html?ics=gbk&ocs=gbk&title=%CA%B5%D3%C3%B5%C4%C3%E2%B7%D1%D6%D0%CE%C4%B7%D6%B4%CA%B7%FE%CE%F1")));
但返回的内容是
<?xml version="1.0" encoding="gbk" ?>
<total_response>
<svalid>36000</svalid>
<keyword>
<info>
<count>0</count>
<errno>-1</errno>
<errinfo>Zero results </errinfo>
<nextuptime>1291287160</nextuptime>
<keep>0</keep>
</info>
<result>
</result>
</keyword>
</total_response>
浏览器返回的内容是
<?xml version="1.0" encoding="gbk" ?>
<total_response>
<svalid>36000</svalid>
<keyword>
<info>
<count>2</count>
<errno>0</errno>
<nextuptime>1291287160</nextuptime>
<keep>0</keep>
</info>
<result>
<item>
<kw><![CDATA[免费]]></kw>
</item>
<item>
<kw><![CDATA[中文]]></kw>
</item>
</result>
</keyword>
</total_response>
我用的是discuz的分词服务
[解决办法]
会不会是url的问题,title=%CA%B5%D3%C3%B5%C4%C3%E2%B7%D1%D6%D0%CE%C4%B7%D6%B4%CA%B7%FE%CE%F1这个已经被浏览器转换了,你尝试传递原始的中文字符看看给QNetworkAccessManager看看
[解决办法]