由网友(七分倦瘾)分享简介:我使用的是加载一些数据,包含Latin-1字符,在web视图字符串的uri = Uri.en code(HTML);webview.loadData(URI,text / html的,ISO-8859-1);在显示时,拉丁文字符被奇怪的字符替换。如果我直接在一个TextView(只是为了测试),拉丁字符正确显示。加载...![MySQL 使用 Load Data Infile 命令 导入数据的方法](/d/file/2023/09-17/265941160a9c667363c5535fb0077d30.png)
我使用的是加载一些数据,包含Latin-1字符,在web视图
字符串的uri = Uri.en code(HTML);
webview.loadData(URI,text / html的,ISO-8859-1);
在显示时,拉丁文字符被奇怪的字符替换。
如果我直接在一个TextView(只是为了测试),拉丁字符正确显示。加载HTML
任何人都可以帮忙吗?
感谢
HTML:
< XML版本=1.0编码=ISO-8859-1&GT?;
!< DOCTYPE HTML PUBLIC - // WAPFORUM // DTD XHTML 1.0移动// ENhttp://www.wapforum.org/DTD/xhtml-mobile10.dtd">
< HTML的xmlns =http://www.w3.org/1999/xhtml>
<! - 一些HTML - >
< / HTML>
![MySQL 使用 Load Data Infile 命令 导入数据的方法](/d/file/2023/09-17/265941160a9c667363c5535fb0077d30.png)
解决方案
只有这样,有它的工作,作为评论的这里:
webview.loadDataWithBaseURL(假货://不是/必要,HTML,text / html的,UTF-8,);
没有URI编码,UTF-8 ... loadData错误?
I'm loading some data, containing latin-1 characters, in a WebView using
String uri = Uri.encode(html);
webview.loadData(uri, "text/html", "ISO-8859-1");
When displayed, the latin1 characters are replaced by weird characters.
If I load the html directly in a TextView (just to test), latin characters are properly displayed.
Anybody can help?
Thanks
html:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- some html -->
</html>
解决方案
Only way to have it working, as commented here:
webview.loadDataWithBaseURL("fake://not/needed", html, "text/html", "utf-8", "");
No URI encoding, utf-8... loadData bug?
相关推荐
最新文章