作者peterchern (CortGB94终於修好了)
看板java
标题[问题] 请问一个关於URLConnection的问题
时间Fri Jun 17 16:15:00 2011
我想要写一个可以读网页的程式
基本上读出来就像检视网页原始码那样
但是我写的程式 google可以读的到 kimo却读不到 会出现乱码的问题
我有看了一些资料 加上了Charset big5 但是仍然是读不到
想请教一下版上大大我的程式是出了什麽问题
以下是我的程式码
public void GetHTML(String Address, String OutputFile)
throws IOException, Exception
{
URL test=new URL(Address);
URLConnection URLConn = (HttpURLConnection)test.openConnection();
URLConn.setRequestProperty("User-agent","IE/6.0");
URLConn.setRequestProperty("Accept-Charset", "Big5,utf-8");
}
感谢~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 125.233.154.35
1F:推 PttTime:new InputStreamReader(URLConn.getInputStream(),"UTF-8" 06/22 22:47