使用默认get方法抓取网页后,得到的数据是什么数据格式?,转成什么格式才会使中文字不出现乱码,注意:windows和linux系统下均需要适用

解决方案 »

  1.   


    you can use the getResponseBodyAsString method which will automatically use the encoding specified in the Content-Type header or ISO-8859-1 if no charset is specifiedhttp://hc.apache.org/httpclient-3.x/charencodings.html
    遇到问题,先查文档,再去官网,最后google
      

  2.   

    response.getEntity().getContent() 返回的是InputStreamresponse.getEntity().getContentEncoding() 可以得到对方的字符集然后就自己处理了。
      

  3.   

    默认抓到的是ISO-8859-1 编码,需要转为其他编码。跟操作系统无关。
      

  4.   


    response.getEntity().getContentEncoding()