Issue
I'm trying to display the following html code in a WebView:
<!DOCTYPE html><html><body> <p> c'est la vie</p> </body>
</html>
The symbol ' is encoded as '
I call this method to load the html is a WebView:
webview.loadData(contentText, "text/html", null);
For some reason, the WebView displays:
c&
instead of :
c'est la vie
Do you know how to solve this ?
Solution
Try this
String unencodedHtml = "<!DOCTYPE html><html><body> <p> c'est la vie</p> </body></html>";
String encodedHtml = Base64.encodeToString(unencodedHtml.getBytes(),
Base64.NO_PADDING);
myWebView.loadData(encodedHtml, "text/html", "base64");
for more info, read the official guide about Building web apps in WebView
Answered By - Kevin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.