乱码 大虾指点

rain1976 2003-09-13 03:26:43
InputStream l_urlStream;
URL l_url = new URL(U);

HttpURLConnection l_connection = (HttpURLConnection) l_url.openConnection();
l_connection.connect();

l_urlStream = l_connection.getInputStream();
BufferedReader read = new BufferedReader(new InputStreamReader(l_urlStream));
String sCurrentLine="";
String sTotalString="";
while ((sCurrentLine = read.readLine()) != null)
{
sTotalString+=sCurrentLine;
}
int begin=sTotalString.indexOf("<!--RS-->");
int end=sTotalString.lastIndexOf("<!--RE-->");

sTotalString=sTotalString.substring(begin,end);

// read=new BufferedReader( new StringReader(sTotalString));
InputStreamReader sr=new InputStreamReader(new StringBufferInputStream(sTotalString),"UTF-8");
read=new BufferedReader(sr);
先将流读出在转换成流 在读出的时候就是乱码
...全文
22 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
rain1976 2003-09-13
  • 打赏
  • 举报
回复
我的是要把流的内容先读成字符串 然后再转换成流 在读
YuLimin 2003-09-13
  • 打赏
  • 举报
回复
请参照我在这里的回复
http://expert.csdn.net/Expert/topic/2238/2238917.xml

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧