gb2312 - Android用okhttp抓取网页内容乱码如何解决?
PHP中文网
PHP中文网 2017-04-17 15:36:19
0
3
653

Android平台用okhttp的get请求抓取网页全文,然后中文乱码,如何破?
页面编码 gb2312

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
Peter_Zhu

You can use jsoup to capture the page. As for the garbled code conversion encoding format, is it useless?

Peter_Zhu

OkHttp post request encoding problem solution method
In the callback method onResponse method
byte[] b = response.body().bytes(); //Get the bytes of data
String info = new String(b, "GB2312"); //Then convert it to gb2312

巴扎黑

This is also okhttp crawling data and grabbing garbled characters
You can take a look
http://www.qianlipp.com/124.html

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template