【发布时间】:2012-09-10 13:34:50
【问题描述】:
我有一个使用 WebView 并使用 WebView.LoadData() 呈现 html 数据的 Activity;
它适用于大多数 html 数据,但如果 Html 包含像 "
& # 6 0 ; p & # 6 2 ; 0;"
WebView 无法正确解码该 html 并在 WebView 中显示 html 标签。
虽然我已经尝试过这段代码:
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中是否传递了任何编码?
标签: android html android-webview