以下是我研究的成果,希望对您有帮助:
Java代码
class="star" src="/Upload/Images/2014072115/40B102E0EF997EA6.png" alt="收藏代码" />
- sb = new StringBuffer();
- HttpEntity entity = response.getEntity();
- InputStream is = entity.getContent();
- BufferedReader br = new BufferedReader(
- new InputStreamReader(is,"GB2312"));
- String data = "";
-
- while ((data = br.readLine()) != null) {
- sb.append(data);
- }
- String result = sb.toString();
Java代码
我解释一下,
Java代码
- BufferedReader br = new BufferedReader(
- new InputStreamReader(is,"GB2312"));
是读取要改编码的源,源的格式是GB2312的,安源格式读进来,然后再对源码转换成想要的编码就行