[Android] Show Html content in WebView without garbled text

Content is your html content, and load data by using “UTF-8”.

webView.loadDataWithBaseURL(“”, content, “text/html”, “UTF-8”, “”);

Google Document:

loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl)

Loads the given data(html) into this WebView, using baseUrl as the base URL for the content.

loadData(String data, String mimeType, String encoding)

Loads the given data(html) into this WebView using a ‘data’ scheme URL.

<Note>data(html) can’t contain ’#’, ‘%’, ‘\’, ‘?’.

loadUrl(String url)

Loads the given URL.


One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.