对的WebView和ICS UTF-8编码 [英] UTF-8 encoding on WebView and ICS
问题描述
要正确显示在的WebView
,我通常会使用 DOCTYPE
和<$ C UTF-8文本$ C>元标签:
&LT; META HTTP-当量=Content-Type的CONTENT =text / html的;字符集= UTF-8/&GT;
和我使用的提示,我已经看到了堆栈溢出:
字符串= URLEn coder.en code(字符串,UTF-8)的replaceAll(\\ +,)。
这是正常工作的姜饼及以上的Android版本,但我的Nexus S最近收到的冰淇淋三明治更新,而像电子
,法国字符A
,è
等显示如下: A©
为例。
我不知道,如果ISO-XXXX-1编码的解决方案,但如果有人有同样的问题,欢迎交流。
请尝试使用方法loadDataWithBaseURL随机字符串为其他PARAMS而不是loadData P>
To correctly display UTF-8 text in a WebView
, I usually use a doctype
and a meta
tag :
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
and I use a tip I've seen on Stack Overflow:
string = URLEncoder.encode(string, "UTF-8").replaceAll("\\+", " ");
That works fine on Gingerbread and older Android versions, but my Nexus S recently received the Ice Cream Sandwich update, and French characters like é
, à
, è
, etc. are displayed like this: é
, for example.
I don't know if the ISO-xxxx-1 encoding is the solution, but if someone had the same problem, please share.
Try using the method loadDataWithBaseURL with random String for the other params instead of loadData
这篇关于对的WebView和ICS UTF-8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!