Java設定頁面編碼的幾個方式筆記:
String result =
EntityUtils.toString(response.getEntity(),"UTF-8");
GetMethod getMethod = new
GetMethod("http://www.aaa.com");
//設置頁面編碼
getMethod.getParams().setContentCharset("UTF-B");
getMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,"UTF-8");
getMethod.addRequestHeader("Content-Type",
"text/html; charset=UTF-8");
沒有留言:
張貼留言