Web view utf fix

This commit is contained in:
Vladimir Enchev
2015-11-06 13:45:39 +02:00
parent 523e5bfbce
commit 77765fc014
3 changed files with 6 additions and 6 deletions

View File

@ -5,6 +5,6 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
</head> </head>
<body> <body>
<span style="color:red">Test</span> <span style="color:red">TestÖ</span>
</body> </body>
</html> </html>

View File

@ -75,7 +75,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
// <hide> // <hide>
let actual; let actual;
let expectedTitle = 'MyTitle'; let expectedTitle = 'MyTitle';
let expectedHtml = '<span style="color:red">Test</span>'; let expectedHtml = '<span style="color:red">TestÖ</span>';
if (webView.ios) { if (webView.ios) {
actual = webView.ios.stringByEvaluatingJavaScriptFromString("document.body.innerHTML").trim(); actual = webView.ios.stringByEvaluatingJavaScriptFromString("document.body.innerHTML").trim();
@ -120,7 +120,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
if (webView.ios) { if (webView.ios) {
actual = webView.ios.stringByEvaluatingJavaScriptFromString("document.body.innerHTML").trim(); 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) { } else if (webView.android) {
actual = webView.android.getTitle(); actual = webView.android.getTitle();
expected = 'MyTitle'; expected = 'MyTitle';
@ -144,7 +144,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
message = "Error loading " + args.url + ": " + args.error; 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> // </snippet>
} }

View File

@ -104,7 +104,7 @@ export class WebView extends common.WebView {
} }
var baseUrl = `file:///${path.substring(0, path.lastIndexOf('/') + 1) }`; 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) { public _loadHttp(src: string) {
@ -121,7 +121,7 @@ export class WebView extends common.WebView {
} }
var baseUrl = `file:///${fs.knownFolders.currentApp().path}/`; 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 { get canGoBack(): boolean {