[問題] 請問big5編碼
想請教一下大家在處理BIG5編碼的網頁時都是如 何處理呢?
因為EntityUtils 似乎沒有支援BIG5..所以小弟的程 式是這樣處理的(如下)
可是發現再遇到一些特殊字元如 " > 的時候都會 變的怪怪的~
感謝指教!!
public static String GET2getWEB(String linkString)
{
byte[] byteResponse = null;//FOR BIG 5
String strRet = null;
try {
HttpGet GET2LINK = new HttpGet (linkString);
/* 取得HTTP response */
HttpResponse httpResponse = new DefaultHttpClient() .execute(GET2LINK);
HttpEntity entity = httpResponse.getEntity();
/* 取出回應字串 *///
strRet = EntityUtils.toString(entity,HTTP.UTF_8); //for big5 編碼
if (entity != null && HttpStatus.SC_OK == httpResponse.getStatusLine().getStatusCode())
{
//strRet = EntityUtils.toString(entity,HTTP.ISO_8859_1);
//strRet = EntityUtils.toString(entity);
byteResponse = EntityUtils.toByteArray(entity);
strRet = EncodingUtils.getString(byteResponse, "big5");
}
} catch (Exception e) { e.printStackTrace(); }
return strRet; }//end of post2getWEB
--
posted from android bbs reader on my HTC Sensation XE with Beats Audio Z715e
https://market.android.com/details?id=com.bbs.reader
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 42.72.204.134
※ 編輯: Magicx 來自: 114.34.226.28 (01/16 00:50)
→
01/16 21:48, , 1F
01/16 21:48, 1F
→
01/16 21:49, , 2F
01/16 21:49, 2F
→
01/16 21:51, , 3F
01/16 21:51, 3F
→
01/16 21:52, , 4F
01/16 21:52, 4F
→
01/16 21:52, , 5F
01/16 21:52, 5F
→
01/16 21:54, , 6F
01/16 21:54, 6F
討論串 (同標題文章)