Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何解码arabics的html内容以在android webview中显示?_Javascript_Android_Html_Css - Fatal编程技术网

Javascript 如何解码arabics的html内容以在android webview中显示?

Javascript 如何解码arabics的html内容以在android webview中显示?,javascript,android,html,css,Javascript,Android,Html,Css,我收到的阿拉伯api的回复是这样的 {"content":"<div class="page-head">\r\n<h3>\u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0639\u0646\u0627<\/h3>\r\n<h4 style="box-sizing: border-box; line-h

我收到的阿拉伯api的回复是这样的

 {"content":"<div class="page-head">\r\n<h3>\u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0639\u0646\u0627<\/h3>\r\n<h4 style="box-sizing: border-box; line-height: 1.5; margin: 0.8em 0px; font-family: proxima-nova, sans-serif; font-size: 18px; font-weight: 400; letter-spacing: 0.06em; color: #4f4f4f; font-style: normal; font-variant: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;">\u0644\u0645\u0627\u0630\u0627 "\u0645\u0646 \u0646\u062d\u0646" \u0635\u0641\u062d\u0629 \u0627\u0644\u0635\u062e\u0648\u0631: \u0648\u0647\u0648 \u064a\u0631\u0648\u064a \u0644\u0646\u0627 \u0642\u0635\u0629.<\/h4>\r\n<\/div>\r\n<div class="col2-set content-seperator"> <\/div>","success":1,"error":false}
我从response解析了内容(对于英语,它工作得很好),对于arabics,它显示为上面的内容。当我使用显示时,它在webview中以方框格式显示。如何解码html并以阿拉伯语显示

这是我在android中用于在webview中加载的内容

       staticPage.loadData(
                Html.fromHtml( content)
                        .toString(), "text/html", "utf-8");

提前感谢

在加载html之前尝试此设置

WebSettings settings = staticPage.getSettings();
settings.setDefaultTextEncodingName("utf-8");
并使用charset=utf-8

staticPage.loadData(
            Html.fromHtml( content)
                    .toString(), "text/html; charset=utf-8", "utf-8");