mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Web view utf fix
This commit is contained in:
@ -5,6 +5,6 @@
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<span style="color:red">Test</span>
|
||||
<span style="color:red">TestÖ</span>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -75,7 +75,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
|
||||
// <hide>
|
||||
let actual;
|
||||
let expectedTitle = 'MyTitle';
|
||||
let expectedHtml = '<span style="color:red">Test</span>';
|
||||
let expectedHtml = '<span style="color:red">TestÖ</span>';
|
||||
|
||||
if (webView.ios) {
|
||||
actual = webView.ios.stringByEvaluatingJavaScriptFromString("document.body.innerHTML").trim();
|
||||
@ -120,7 +120,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
|
||||
|
||||
if (webView.ios) {
|
||||
actual = webView.ios.stringByEvaluatingJavaScriptFromString("document.body.innerHTML").trim();
|
||||
expected = '<span style="color:red">Test</span>';
|
||||
expected = '<span style="color:red">TestÖ</span>';
|
||||
} else if (webView.android) {
|
||||
actual = webView.android.getTitle();
|
||||
expected = 'MyTitle';
|
||||
@ -144,7 +144,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
|
||||
message = "Error loading " + args.url + ": " + args.error;
|
||||
}
|
||||
});
|
||||
webView.src = '<!DOCTYPE html><html><head><title>MyTitle</title><meta charset="utf-8" /></head><body><span style="color:red">Test</span></body></html>';
|
||||
webView.src = '<!DOCTYPE html><html><head><title>MyTitle</title><meta charset="utf-8" /></head><body><span style="color:red">TestÖ</span></body></html>';
|
||||
// ```
|
||||
// </snippet>
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ export class WebView extends common.WebView {
|
||||
}
|
||||
|
||||
var baseUrl = `file:///${path.substring(0, path.lastIndexOf('/') + 1) }`;
|
||||
this._android.loadDataWithBaseURL(baseUrl, content, "text/html; charset=utf-8", "utf-8", null);
|
||||
this._android.loadDataWithBaseURL(baseUrl, content, "text/html;", "utf-8", null);
|
||||
}
|
||||
|
||||
public _loadHttp(src: string) {
|
||||
@ -121,7 +121,7 @@ export class WebView extends common.WebView {
|
||||
}
|
||||
|
||||
var baseUrl = `file:///${fs.knownFolders.currentApp().path}/`;
|
||||
this._android.loadDataWithBaseURL(baseUrl, src, "text/html; charset=utf-8", "utf-8", null);
|
||||
this._android.loadDataWithBaseURL(baseUrl, src, "text/html;", "utf-8", null);
|
||||
}
|
||||
|
||||
get canGoBack(): boolean {
|
||||
|
Reference in New Issue
Block a user