Android webView 中loadData方法加载 带中文时出现乱码

             WebView出现乱码
LoadData方法来解析html的,但是据说这是官方的一个BUG,不能用来解析中文。

采用loadDataWithBaseURL的方法,其中codeingType设置为utf-8就OK了。
loadDataWithBaseURL
如果单纯显示文字的话可以写
webView.loadDataWithBaseURL(null, string, "text/html", "utf-8", null);
如果要显示图片
可以写webView.loadDataWithBaseURL(baseUrl, string, "text/html", "utf-8", null); 其中baseUrl为你存储照片的路径。
原文地址:https://www.cnblogs.com/orangebook/p/3650920.html