解决获取到的网页信息 中文乱码

其实想知道的比较详细可以去看这个讨论帖:http://www.iteye.com/topic/509046


直接附上代码

public static String Stringencode(HttpResponse response)
	{
		StringBuffer sb = new StringBuffer();  
        HttpEntity entity = response.getEntity();  
        InputStream is;
		try {
			is = entity.getContent();
			BufferedReader br = new BufferedReader(  
	                new InputStreamReader(is,"UTF-8"));  
	        String data = "";  

	        while ((data = br.readLine()) != null) {  
	            sb.append(data);  
	        }  
	        
		} catch (IllegalStateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}  
		String strResult = sb.toString(); 
        return strResult;
	}

你可能感兴趣的:(解决获取到的网页信息 中文乱码)