1
我有一個使用WebView並使用WebView.LoadData()呈現html數據的Activity; 它對大部分html數據都正常工作,但是如果Html包含像「
&#6 0; p &#6 2; &#6 0; WebView無法正確解碼該html,並在WebView中顯示html標籤。如何在WebView中解碼HTML引號
Althogh我曾經嘗試這樣的代碼:
for(char c: rssFeed.getDescription().toCharArray()){
switch (c) {
case '#': htmlBuffer.append("%23"); break;
case '%': htmlBuffer.append("%25"); break;
case '\'': htmlBuffer.append("%27"); break;
case '?': htmlBuffer.append("%3f"); break;
case '&': htmlBuffer.append("%26"); break;
case ':': htmlBuffer.append("%3A"); break;
case ';': htmlBuffer.append("%3B") ;break;
case '/': htmlBuffer.append("%2F"); break;
default:
htmlBuffer.append(c);
break;
}
}
,但於事無補。
在'WebView.loadData'你傳遞任何編碼? –
是的,它是utf-8 –