WebView里显示加载一段带中文的HTML时,使用webview.loadData(str,"text/html","utf-8");出现乱码,后面的编码也试过gbk或gb2312,或加上设置webview.getsettings().setdefaultEncode("utf-8")都没有效果。
解决方案:
采用loadDataWithBaseURL(null,data, "text/html", "utf-8",null);
就能显示中文了。
就能显示中文了。
WebView里显示加载一段带中文的HTML时,使用webview.loadData(str,"text/html","utf-8");出现乱码,后面的编码也试过gbk或gb2312,或加上设置webview.getsettings().setdefaultEncode("utf-8")都没有效果。
解决方案:
采用loadDataWithBaseURL(null,data, "text/html", "utf-8",null);
就能显示中文了。
就能显示中文了。