mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Merge pull request #845 from emiloberg/webview-utf8
web-view loads local data with UTF-8
This commit is contained in:
@ -91,13 +91,13 @@ export class WebView extends common.WebView {
|
|||||||
if (file) {
|
if (file) {
|
||||||
var baseUrl = `file:///${src.substring(0, src.lastIndexOf('/') + 1)}`;
|
var baseUrl = `file:///${src.substring(0, src.lastIndexOf('/') + 1)}`;
|
||||||
file.readText().then(r => {
|
file.readText().then(r => {
|
||||||
this._android.loadDataWithBaseURL(baseUrl, r, "text/html", null, null);
|
this._android.loadDataWithBaseURL(baseUrl, r, "text/html; charset=utf-8", "utf-8", null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (src.indexOf("http://") === 0 || src.indexOf("https://") === 0) {
|
} else if (src.indexOf("http://") === 0 || src.indexOf("https://") === 0) {
|
||||||
this._android.loadUrl(src);
|
this._android.loadUrl(src);
|
||||||
} else {
|
} else {
|
||||||
this._android.loadData(src, "text/html", null);
|
this._android.loadData(src, "text/html; charset=utf-8", "utf-8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user