Characters in my webview are destroyed when i use utf-8. It displays question mark on black diamond background. When I use other encoding they are garbled. I've tried the solution from this thread, my code looks like
input = assetManager.open("xxx.html");
Integer size = input.available();
byte[] buffer = new byte[size];
input.read(buffer);
text = new String(buffer);
WebSettings settings = webView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
webView.loadDataWithBaseURL("file:///android_asset/",text,"text/html; charset=utf-8", "utf-8",null);
the HTML header
<html ><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="xxxxx">
<title>xxx</title>
<style type="text/css">
@font-face {
font-family: fonttt;
src: url("file:///android_asset/roboto.ttf")
}
body {
font-family: fonttt;
font-size: medium;
text-align: justify;
}
</style>
</head>
I don't get why utf-8 doesn't work and why when I use other encoding (windows-1252, ISO-8859-1) characters are garbled.