您好我正在尝试加载HTML(来自字符串)
这是RSS提要(我从那里获得一个链接,然后从特定类中获取HTML字符串):
http://www.naec.ge/index.php?option=com_rsssyndicator&feed_id=1&format=raw
正如您所看到的那样,它是在let start: Int = top / 100
let end: Int = bottom / 100 + 1
return (start...end).map { cellAttributes[$0] }
中编码的,但我仍然无法渲染它,它会给我这样的结果:android web view result
以下是代码片段:
utf-8
此外,我不认为有任何问题:
class parseText extends AsyncTask<String,Void,String>
{
protected String doInBackground(String... params)
{
try {
org.jsoup.nodes.Document doc = Jsoup.connect(url).get();
System.out.println("hey kurwo "+doc.getElementsByClass("article-content"));
data = doc.getElementsByClass("article-content").toString();
} catch (IOException e) {
e.printStackTrace(); System.out.println("jeban!!");
}
return null;
}
@Override
protected void onPostExecute(String s) {
System.out.println("chiken boneZZZ");
view.loadData(data,"text/html","UTF-8");
super.onPostExecute(s);
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
}
}
答案 0 :(得分:0)
这是一个你必须使用loaddatawithbaseurl而不是loadData()的交易,这里是例子:这将不起作用view.loadData(data,"text/html","utf-8");
这将有效:
view.loadDataWithBaseURL(null,data,&#34; text / html&#34;,&#34; UTF-8&#34;,null);