生成静态页乱码问题?
public static String snatchHtml(){
StringBuffer html = new StringBuffer();
try{
URL url = new URL("html://www.xn518.com/index.jsp");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
InputStreamReader isr = new InputStreamReader(conn.getInputStream());
BufferedReader br = new BufferedReader(isr);
String temp;
while ((temp = br.readLine()) != null) {
html.append(temp).append("\n");
}
br.close();
isr.close();
}catch(Exception e){
System.out.println(e.getMessage());
}
return html.toString();
}
以上是生成html文件的代码,但生成出来的是乱码请大家帮忙看看是怎么回事?