如何让角色可见?

时间:2016-04-22 10:06:14

标签: c++ qt

我向支付宝发送请求并得到此回复。我觉得有些字符是汉字,我看不到它们。

如何更改它以便将其视为中文字符或可查看的内容?



testTagInput




这是我在Qt中的代码:

<head><title>\xD6\xA7\xB8\xB6\xB1\
xA6 - \xCD\xF8\xC9\xCF\xD6\xA7\xB8\xB6 \xB0\xB2\xC8\xAB\xBF\xEC\xCB\xD9\xA3\xA1</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" /><meta http-equiv=\"x-ua-compatible\" content=\"ie=7\" />
<meta name=\"description\" content=\"\xD6\xD0\xB9\xFA\xD7\xEE\xB4\xF3\xB5\xC4\xB5\xDA\xC8\xFD\xB7\xBD\xB5\xE7\xD7\xD3\xD6\xA7\xB8\xB6\xB7\xFE\xCE\xF1\xCC\xE1\xB9\xA9\xC9\xCC\" /><meta name=\"keywords\" content=\"\xCD\
xF8\xC9\xCF\xB9\xBA\xCE\xEF/\xCD\xF8\xC9\xCF\xD6\xA7\xB8\xB6/\xB0\xB2\xC8\xAB\xD6\xA7\xB8\xB6/\xB0\xB2\xC8\xAB\xB9\xBA\xCE\xEF/\xB9\xBA\xCE\xEF\xA3\xAC\xB0\xB2\xC8\xAB/\xD6\xA7\xB8\xB6/\xD6\xA7\xB8\xB6\xB1\xA6,\xD4\xDA\xCF\xD
F/\xB8\xB6\xBF\xEE,\xCA\xD5\xBF\xEE/\xCD\xF8\xC9\xCF,\xC3\xB3\xD2\xD7/\xCD\xF8\xC9\xCF\xC3\xB3\xD2\xD7\" /><link rel=\"icon\" href=\"https://img.alipay.com:443/img/icon/favicon.ico\" type=\"image/x-icon\" /><l
ink rel=\"shortcut icon\" href=\"https://img.alipay.com:443/img/icon/favicon.ico\" type=\"image/x-icon\" /><link rel=\"stylesheet\" type=\"text/css\" href=\"https://img.alipay.com:443/assets/c/global/global_v1.css?t=20081
119.css\" /><link rel=\"stylesheet\" type=\"text/css\" href=\"https://img.alipay.com:443/assets/c/sys/sys.tabs.css?t=20080709.css\" /><link rel=\"stylesheet\" type=\"text/css\" href=\"https://img.alipay.com:443/assets
/c/typography/ot.old.css?t=20080709.css\" /><link rel=\"stylesheet\" type=\"text/css\" href=\"https://img.alipay.com:443/assets/c/typography/as.kt.css?t=20080709.css\" /></head>
<!--[if gte IE 6]><script type='text/javascript' src='https://img.alipay.com:443/js/sys/sys.object.js?t=20080122.js' defer='d
efer'></script><![endif]--><style type=\"text/css\">.topsearch{font-size:12px;position:relative;}.topsearch form{margin:-2px 0 0 0;padding:0}.topsearch form input{width:94px;height:13px;line-height:13p
x;border:1px solid #d7d7d7;padding:2px 2px 0 2px;font-size:12px}.topsearch form button{width:40px;height:18px;margin:0 0 0 4px;border:1px solid #d7d7d7;background:#f3f3f3;padding:0}.topsearch .xnews{border:0;position:
absolute;top:0;right:-15px}#Header #QuickLinks .QuickLinksMore{position:relative;}#Header #QuickLinks .QuickLinksMore ol{display:none;position:absolute;top:18px;left:5px;float:none;width:65px;text-align:left;z-index:9
999;text-align:left;border:1px solid #ccc;background:#fff;margin:0;padding:5px 0}#Header #QuickLinks .QuickLinksMore ol li{display:block;float:none;background:none;margin:0;padding:2px 3px;text-align:center}#Header #Q
uickLinks .QuickLinksMore ol li a{text-decoration:none;color:#666;margin:0;padding:0}#Header #QuickLinks .QuickLinksMore ol li a:hover{color:#f60}}</style><!-- Header start--><div id=\"Header\" class=\"cle
arfix\">  <!-- HeadTop start-->  <div id=\"HeadTop\">                    <div id=\"Logo\"><a href=\"https://www.alipay.com\" class=\"logo\"></a></div>                    <div id=\"QuickLink
s\" style=\"padding-top:8px\">      <ul><li class=\"topsearch\" style=\"background:none\"><form id=\"topsearch\" name=\"topsearch\" action=\"https://help.alipay.com/support/search_new_result.htm\" method=\"get
\" onsubmit=\"return checkTopSearch()\"><input type=\"hidden\" name=\"_form_token\" value=\"kp76AFTuuAIZrf7eAcL6jMopmn2ka5fL\"/><input id=\"word\" name=\"word\" type=\"text\"/><button type=\"submit
\">\xCB\xD1\xCB\xF7</button></form></li><li><a href=\"https://help.alipay.com/support/index.htm\" target=\"_blank\">\xB0\xEF\xD6\xFA\xD6\xD0\xD0\xC4</a></li><li><a href=\"https:
//jifen.alipay.com/index.htm?src=yy_jifen_sy01\" target=\"_blank\">\xBF\xEC\xC0\xD6\xBB\xFD\xB7\xD6</a></li><li id=\"QuickLinksMore1\" class=\"QuickLinksMore\"><a href=\"https://wow.alipay.com?src=wow_ho
me\">\xCD\xDB\xA3\xA1\xD6\xA7\xB8\xB6\xB1\xA6</a><ol><li><a href=\"https://wow.alipay.com/shop.htm?src=shop_home\">\xB4\xD9&nbsp;\xCF\xFA&nbsp;\xBD\xD6</a></li><li><a href=\"https://wow
.alipay.com/overseas.htm?src=overseas_home\">\xBA\xA3\xCD\xE2\xB9\xBA\xCE\xEF</a></li><li><a href=\"https://market.alipay.com/alipay/customer_index.htm?src=customer_home\">\xBA\xCF\xD7\xF7\xC9\xCC\xBC\xD2</a></l
i><li><a href=\"https://wow.alipay.com/services.htm?src=services_home\">\xBB\xE1\xD4\xB1\xB7\xFE\xCE\xF1</a></li></ol></li></ul><script type=\"text/javascript\">var search
Info=document.getElementById(\"word\");function searchclearInfoJs(){if(searchInfo.value==\"\xCA\xE4\xC8\xEB\xC4\xFA\xB5\xC4\xCE\xCA\xCC\xE2\"){searchInfo.style.color=\"#000\";searchInfo.value=\
"\";}}function searchinputInfoJs(){if(searchInfo.value==\"\"){searchInfo.style.color=\"#999\";searchInfo.value=\"\xCA\xE4\xC8\xEB\xC4\xFA\xB5\xC4\xCE\xCA\xCC\xE2\";}}if(se
archInfo!=undefined){if(searchInfo.value==\"\"||searchInfo.value==\"\xCA\xE4\xC8\xEB\xC4\xFA\xB5\xC4\xCE\xCA\xCC\xE2\"){searchInfo.style.color=\"#999\";searchInfo.value=\"\xCA\xE4\xC8\xEB\xC4\xFA\x
B5\xC4\xCE\xCA\xCC\xE2\";searchInfo.onfocus=function(){searchclearInfoJs();}searchInfo.onblur=function(){searchinputInfoJs();}}}function showMore(obj){var oMor
e=document.getElementById(obj);var oMoreUl=oMore.getElementsByTagName(\"ol\")[0];if(document.all){//ieoMore.setAttribute(\"onmouseover\",eval(function(){oMoreUl.style.display=\"block\";}));oMore.setAttribu
te(\"onmouseout\",eval(function(){oMoreUl.style.display=\"none\";}));oMoreUl.setAttribute(\"onmouseover\",eval(function(){oMoreUl.style.display=\"block\";}));oMoreUl.setAttribute(\"onmouseout\",eval(function(){oMo
reUl.style.display=\"none\";}));}else{//ffoMore.addEventListener(\"mouseover\", function(){oMoreUl.style.display=\"block\";}, false);oMore.addEventListener(\"mouseout\", function(){oMoreUl.style.display=\"none
\";}, false);oMoreUl.addEventListener(\"mouseover\", function(){oMoreUl.style.display=\"block\";}, false);oMoreUl.addEventListener(\"mouseout\", function(){oMoreUl.style.display=\"none\";}, false);}}sh
owMore(\"QuickLinksMore1\");function checkTopSearch(){if(searchInfo.value==\"\"||searchInfo.value==\"\xCA\xE4\xC8\xEB\xC4\xFA\xB5\xC4\xCE\xCA\xCC\xE2\"){alert(\"\xC7\xEB\xCA\xE4\xC8\xEB\xC4\xFA\xB5\xC4\xCE\xCA\x
CC\xE2 \xC8\xE7\xA3\xBA\xCD\xFC\xBC\xC7\xC3\xDC\xC2\xEB\");return false;}return true;}</script><ul style=\"clear:both\"><li class=\"Inpour\" style=\"background:none\"><a href=\"https://www.
alipay.com/user/inpour_request.htm?src=yy_content_czbutton\"><img style=\"position:absolute;top:-15px;margin-left:70px;\"src=\"https://img.alipay.com:443/assets/i/base/icon/sjf.gif\"  width=\"43\" height=\"22\" border=\"0\" a
lt=\"\xB3\xE4\xD6\xB5\xCB\xCD\xBB\xFD\xB7\xD6\"/></a></li><li><a href=\"https://trust.alipay.com\" target=\"_blank\">\xD0\xC5\xC8\xCE\xBC\xC6\xBB\xAE</a></li>\
t<li>\xC4\xFA\xBA\xC3\xA3\xAC\xC7\xEB <a href=\"https://www.alipay.com/user/reg_select.htm\" >\xD7\xA2\xB2\xE1</a> \xBB\xF2 <a href=\"https://www.alipay.com/user/login.htm\">\xB5\xC7\xC2\xBC</a></li>
</ul>  </div>   </div>  <!-- HeadTop ending-->    </div><!-- Header ending--><div id=\"Info\"><div class=\"ExclaimedInfo\"><strong>\xB5\xF7\xCA\xD4\xB4\xED\xCE\x
F3\xA3\xAC\xC7\xEB\xBB\xD8\xB5\xBD\xC7\xEB\xC7\xF3\xC0\xB4\xD4\xB4\xB5\xD8\xA3\xAC\xD6\xD8\xD0\xC2\xB7\xA2\xC6\xF0\xC7\xEB\xC7\xF3\xA1\xA3</strong>    <div class=\"Todo\">\xB4\xED\xCE\xF3\xB4\xFA\xC2\xEB ILLEGAL_PARTNER <
/div>    <ul>      <li>\xCB\xB5\xC3\xF7:\xC8\xE7\xB9\xFB\xC4\xFA\xB2\xBB\xCA\xC7\xD2\xF2\xCE\xAA\xB1\xBE\xBD\xD3\xBF\xDA\xBC\xAF\xB3\xC9\xB5\xF7\xCA\xD4\xB6\xF8\xBF\xB4\xBC\xFB\xB8\xC3\xB4\xED\xCE\xF3\xCC\xE1\xD0\xD1\
xA3\xAC\xC7\xEB\xC1\xAA\xCF\xB5\xB1\xBE\xB4\xCE\xC7\xEB\xC7\xF3\xC0\xB4\xD4\xB4\xCD\xF8\xD5\xBE\xA3\xAC\xB1\xBE\xB4\xED\xCE\xF3\xCA\xF4\xD3\xDA\xCD\xF8\xD5\xBE\xBC\xAF\xB3\xC9\xBD\xD3\xBF\xDA\xB5\xC4\xB4\xED\xCE\xF3\xA1\xA3</
li>    </ul><ul><div class=\"HelpSubmit\"><b>\xCE\xCA\xCC\xE2\xC3\xBB\xBD\xE2\xBE\xF6\xA3\xBF<input type=\"button\" value=\"\xCB\xD1\xCB\xF7\xD5\xD2\xB4\xF0\xB0\xB8\" onclick=\"window.open('http://help
.alipay.com/support/index.htm?src=yy_reach_error','_self')\">\xA3\xAC\xBB\xF2\xD5\xDF<a href=\"http://ask.alipay.com/help/add_help.htm?src=yy_error_ask01\">\xCF\xF2\xCD\xF8\xD3\xD1\xCC\xE1\xCE\xCA</a>\xA1\xA3</b
></div></ul></div></div><!--footer start--><div id=\"Foot\">  <div class=\"Shell clearfix\">    <ul>      <li><a href=\"https://www.alipay.com/static/aboutalipay/about.htm\" target=\"_bla
nk\">\xB9\xD8\xD3\xDA\xD6\xA7\xB8\xB6\xB1\xA6</a></li>      <li><a href=\"https://ue.alipay.com\" target=\"_blank\">\xCC\xE5\xD1\xE9\xBC\xC6\xBB\xAE</a></li>      <li><a href=\"https://blog.alipay.com\" target=\"_blan
k\">\xB9\xD9\xB7\xBD\xB2\xA9\xBF\xCD</a></li>      <li><a href=\"https://job.alipay.com\" target=\"_blank\">\xB3\xCF\xD5\xF7\xD3\xA2\xB2\xC5</a></li>      <li><a href=\"https://www.alipay.com/static/aboutalipay/contac
t.htm\" target=\"_blank\">\xC1\xAA\xCF\xB5\xCE\xD2\xC3\xC7</a></li>            <li><a href=\"https://market.alipay.com/ospay/index.htm\" target=\"_blank\">International Business</a></li>      <li><a href=\"https://www
.alipay.com/static/aboutalipay/englishabout.htm\" target=\"_blank\">About Alipay</a></li>    </ul>  </div>    <ul class=\"CopyRight clearfix\">  <li><a href=\"https://www.alipay.com/static/phone/alipay_pho
ne.htm?src=yy_sy_sjzf\" target=\"_blank\">\xB5\xE7\xBB\xB0\xD6\xA7\xB8\xB6\xB1\xA6</a>\xA3\xBA""400-66-13800 | \xCA\xD6\xBB\xFA\xD6\xA7\xB8\xB6\xB1\xA6\xA3\xBAwap.alipay.com</li>  <li>\xD6\xA7\xB8\xB6\xB1\xA6\xB0\xE6\xC8\
xA8\xCB\xF9\xD3\xD0 2004-2016 ALIPAY.COM</li>  </ul>  <div id=\"ServerNum\">mapi-60-72</div></div><!--footer ending-->"

1 个答案:

答案 0 :(得分:0)

earth_data <- planets_df[planets_df[,"name"]=="Earth",c("diameter", "rotation")] 返回response->readAll(),其中以您问题中显示的格式打印(带有不可打印字符的字节使用QByteArray进行编码)。在以这种原始形式打印文本之前,您必须确定它是如何编码的。从我看到的(在这个答案的评论中)你的文本是UTF-8编码。如此简单的转换为\xXY应该可以实现可读的html:

QString

现在,在文档中,您可以找到其他方式,例如QString html(response->readAll());

要删除html标记并仅获取您必须使用的文本内容QString::fromUtf8

QTextDocument

从您的评论中我可以看到您不需要这最后一步。