android webView.loadData乱码解决

android webView.loadData 乱码解决

webView.getSettings().setDefaultTextEncodingName("UTF -8");//设置默认为utf-8
webView.loadData(htmlData, "text/html", "UTF -8");//API提供的标准用法,无法解决乱码问题
webView.loadData(htmlData, "text/html; charset=UTF-8", null);//这种写法可以正确解码


你可能感兴趣的:(android webView.loadData乱码解决)