Skip to content Skip to sidebar Skip to footer

Web Page At Data:text/html Not Available With Certain Webview Text/html Content Strings

I am using the following Java code to create some HTML for displaying content. public String htmlFromArrayList(ArrayList a) { StringBuilder returnStringBuilder = ne

Solution 1:

Do you have strange characters like percent signs, backslashes or other non alphabetical characters in your i.itemText or i.itemTitle? If you do, that will cause the 'webpage not found' problem.

http://code.google.com/p/android/issues/detail?id=4401

Also, you are not passing in an Encoding, try passing in "UTF-8" instead of null.

mWebView.loadData(htmlFromArrayList(mSummaryItemArrayList), "text/html", "utf-8");

This problem can be worked around by replacing all % symbols with the HTML entity (Ampersand Pound 37): (&#37).

There are reports that if any Chinese characters get fed into your webView, you can still get the "page not found" problem even if you handle the percent sign. So the work around is to try this:

This works with everything plus Chinese characters:

mWebView.loadData(URLEncoder.encode(html,"utf-8").replaceAll("\\+"," "), "text/html", "utf-8");

Sourcehttp://code.google.com/p/android-rss/issues/detail?id=15

Post a Comment for "Web Page At Data:text/html Not Available With Certain Webview Text/html Content Strings"