各位大神,情況是這樣的,領導交代我一直在爬網,現在已經爬到了回復處,在各位大神的幫助下,小弟已經找到了回復的源碼,不過源碼卻是ASCII格式的,請問如何將其轉換為utf格式,方便存入文本文檔中。源碼如下:
這是一個回復內容數據:
\u975e\u5e38\u4e0d\u9519\u7684\u4e00\u7bc7\u6587\u7ae0\uff0c\u5e72\u8d27\uff0c\u5e72\u8d27\u3002\u628a\u793e\u4ea4\u8fd0\u8425\u8bb2\u7684\u900f\u5f7b\u3002
這個全部回復JS的相應數據:
{"errno":0,"data":{"hasmore":true,"comments":[{"user_name":"Fei52012345","user_pic":"http:\/\/tb.himg.baidu.com\/sys\/portraitn\/item\/e8474665693532303132333435da38","user_type":"0","ts":"1431394929000","id":"507196","text":"\u975e\u5e38\u4e0d\u9519\u7684\u4e00\u7bc7\u6587\u7ae0\uff0c\u5e72\u8d27\uff0c\u5e72\u8d27\u3002\u628a\u793e\u4ea4\u8fd0\u8425\u8bb2\u7684\u900f\u5f7b\u3002","from":"weibo","support_count":"1","vip_intro":"","format_ts":"23\u5206\u949f\u524d"},{"user_name":"\u5584\u826f\u7684\u5e73\u6c11","user_pic":"http:\/\/tb.himg.baidu.com\/sys\/portraitn\/item\/21e0c9c6c1bcb5c4c6bdc3f11228","user_type":"0","ts":"1431394912000","id":"507198","text":"\u6709\u601d\u60f3\uff01\u900f\u8fc7\u73b0\u8c61\u770b\u5230\u672c\u8d28\uff01\u73b0\u5728\u7684\u98ce\u6c14\u5c31\u662f\u592a\u6d6e\u4e86\uff0c\u8ba4\u4e3a\u81ea\u5df1\u53ef\u4ee5\u4f5c\u4efb\u4f55\u4e8b\uff0c\u4efb\u4f55\u90fd\u53ef\u80fd\u6210\u529f\uff0c\u5728\u9047\u5230\u95ee\u9898\u4e4b\u524d\u5c31\u8ba4\u4e3a\u81ea\u5df1\u7684\u60f3\u6cd5\u548c\u4f5c\u6cd5\u662f\u771f\u7406\uff01","from":"weibo","support_count":"0","vip_intro":"","format_ts":"23\u5206\u949f\u524d"}],"ts":"1431327560000"}}
這是 json 格式的數據啊。用 org.json 包就行了。會自動轉義的。