Encoding issue with WebView's loadData

后端 未结 8 482
星月不相逢
星月不相逢 2020-12-09 16:21

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\")         


        
相关标签:
8条回答
  • 2020-12-09 17:19
    webView.loadDataWithBaseURL(null, html, "text/html", "utf-8", null); 
    
    0 讨论(0)
  • 2020-12-09 17:20

    AFAIK that: Firstly, loadData() method is used to load raw html code.
    Secondly, just put the html code directly to the loadData(), don't encode it

    You might wanna try like this:

    webview.loadData(uri, "text/html", "ISO-8859-1");
    

    Cheers!

    0 讨论(0)
提交回复
热议问题