如题
        HttpClient httpClient = new DefaultHttpClient();     HttpResponse response ;
     HttpGet get =new HttpGet("http://www.8684.cn/");
     try {
    response = httpClient.execute(get);
HttpEntity entity = response.getEntity();
System.out.println(EntityUtils.toString(entity));
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
  

解决方案 »

  1.   

    在网页输出内容中:进行转码:
    例如:
    str1="akghdkjhasgi";
    String str=new String(str1.getBytes("ISO-8859-1"),"GBK")
    对于“iso-8859-1”和gbk
    你可以换编码。。一个一个换
    utf-8还有就是gb2312
    你自己配。
    各种组合就可以了。我就是这样解决的!
      

  2.   


    HttpClient httpClient = new DefaultHttpClient();        HttpResponse response = null;
            HttpGet get =new HttpGet("http://www.8684.cn/");
            
            try {
                response = httpClient.execute(get);
                HttpEntity entity = response.getEntity();
                
                BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent()));
                String temp = null;
                while( (temp = br.readLine())!=null ){
                 System.out.println(temp);
                }
            } catch (ClientProtocolException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
    直接运行无乱码
    使用BufferedReader来避免乱码
    还有就是楼主记得给分啊。
    哈哈哈哈哈哈哈
      

  3.   

    我这还有两个类似。
    但是是基于javase API的来读取网信息的
    如果楼主给分就共享下。。哈哈