机器人的WebView乱码UTF-8字符。 [英] Android WebView with garbled UTF-8 characters.
本文介绍了机器人的WebView乱码UTF-8字符。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用我的Android应用程序的一些webviews,但不能使他们在UTF-8编码显示。
I'm using some webviews in my android app, but are unable to make them display in utf-8 encoding.
如果用这个,我不会看到我的斯堪的纳维亚charcters:
If use this one I won't see my scandinavian charcters:
mWebView.loadUrl("file:///android_asset/om.html")
如果试试这个,我不会得到任何东西显示在所有
And if try this one, I won't get anything displayed at all
mWebView.loadDataWithBaseURL("file:///android_asset/om.html", null, "text/html", "utf-8",null);
问候
推荐答案
您可以试试,然后再加载数据编辑您的WebView的设置:
You can try to edit the settings of your webview before you load the data:
WebSettings settings = mWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
这篇关于机器人的WebView乱码UTF-8字符。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文