Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.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
Android 如何将带有字符集windows-1251的原始资源加载到WebView?_Android_Webview - Fatal编程技术网

Android 如何将带有字符集windows-1251的原始资源加载到WebView?

Android 如何将带有字符集windows-1251的原始资源加载到WebView?,android,webview,Android,Webview,如何将带有字符集windows-1251的原始资源加载到WebView?对我有效的唯一方法是: 然后 String html = FileUtils.loadRawFileAsBase64(this, R.raw.htmlfile); WebView webView = (WebView) findViewById(R.id.webview); webView.loadData(html, "text/html; charset=windows-1251", "base64"); 有没有办法

如何将带有字符集windows-1251的原始资源加载到WebView?对我有效的唯一方法是:

然后

String html = FileUtils.loadRawFileAsBase64(this, R.raw.htmlfile);
WebView webView = (WebView) findViewById(R.id.webview);
webView.loadData(html, "text/html; charset=windows-1251", "base64");

有没有办法避免base64编码?

如果动态创建web内容,在第节中设置以下字符集可能会有所帮助

字符串头=”;
String html = FileUtils.loadRawFileAsBase64(this, R.raw.htmlfile);
WebView webView = (WebView) findViewById(R.id.webview);
webView.loadData(html, "text/html; charset=windows-1251", "base64");