While working on a project, the customer asked for full honeycomb compatibility. I found two issues today that kept me at least a bit wondering.
“text/html” vs. “html/text”
The following way of loading data into a WebView was used since month and it worked in all ways:
1 | mWebView.loadData(myHtmlContent, "html/text", "utf-8"); |
With honeycomb, the WebView presented a blank page. While not seriously checking the order of “html/text” I debugged the app and couldn’t find an issue like an empty content or an issue while reading files which contains the html code. Than I saw the switched order, changed it to the correct one and it worked.
1 2 | //working call mWebView.loadData(myHtmlContent, "text/html", "utf-8"); |
I thought that a wrong type definition should be handled with a fall back to at least text/html, because a WebView should always fall back to display html, right? Well, they seem to have changed it on honeycomb…
loadData vs loadDataWithBaseURL
The next issue was wrong encoding when the html content was displayed using the method loadData with the call shown above. I tried to dig deeper into it, but was lost until I found a question on stackoverflow about this encoding issue.
This question is not very new, but I am wondering why it worked on Android < 3.x in my case. Beside that, I can't find a good reason why it failed with one call but not with the other. This issue is the reason why I filed my very first bug report on Android.