Android系统。的WebView和loadData [英] Android. WebView and loadData
问题描述
这是可以使用下面的方法为Web视图内容的设置 loadData(字符串数据,字符串MIMETYPE,字符串编码)
如何使用HTML数据不详编码处理这个问题呢?!
有编码列表?!
我知道从我的情况下,HTML来自数据库,并为EN codeD与Latin-1的我的大学。 我尝试设置编码参数为拉丁文1,ISO-8859-1 / ISO-8859-1,但仍然有问题,显示像一个特殊标志,ö,ü。
我会很感激的任何建议。
myWebView.loadData(myHtmlString,text / html的;字符集= UTF-8,NULL);
这完美的作品,尤其是在Android 4.0,这显然忽略了字符编码的 HTML里面。
在测试了2.3和4.0.3。
其实,我不知道是什么,除了BASE64其他值做最后一个参数取。一些谷歌的例子在那里把空。
It's possible to use following method for content's setting of a web-view loadData(String data, String mimeType, String encoding)
How to handle the problem with unknown encoding of html data?!
Is there a list of encodings?!
I know from my college that in my case html comes from DB and is encoded with latin-1. I try to set encoding parameter to latin-1, to ISO-8859-1 / iso-8859-1, but still have problem with displaying of special signs like ä, ö, ü.
I'll be very thankful for any advice.
myWebView.loadData(myHtmlString, "text/html; charset=UTF-8", null);
This works flawlessly, especially on Android 4.0, which apparently ignores character encoding inside HTML.
Tested on 2.3 and 4.0.3.
In fact, I have no idea about what other values besides "base64" does the last parameter take. Some Google examples put null in there.
这篇关于Android系统。的WebView和loadData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!