0

This is my sample html code that suppose to convert to html, I've tested this code on several application and it works fine. This is the code :

WebSettings settings = des.getSettings();
            settings.setDefaultTextEncodingName("utf-8");
            settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
            settings.setSaveFormData(false);
            settings.setSupportZoom(false);
            int fontsize=15;
            if(fontsize>20)fontsize=13;
            settings.setDefaultFontSize(fontsize);
            settings.setBuiltInZoomControls(false);
            des.loadData(
                    "<html><head><style>@font-face { font-family: myface;src: url(\"file:///android_asset/yekan.ttf\");" +
                            "BODY, HTML {background: transparent;  } body,div {  font-family: myface;} </style></head><body><div style='text-align: justify; line-height: 23px;float:right' dir='rtl'>"
                            + dataC.get(0).get("tozih").replace("&quot;","'") + "</div></body></html>",
                    "text/html; charset=utf-8", "UTF-8");

the html is something like this :

<p>ok</p>

When I run the application, the WebView show me exactly the above line, it doesn't shows it as html.

Why is that? what should I do to solve this?

Thanks

1

1 Answer 1

1

Have you tried logging what is dataC.get(0).get("tozih") to see if it is really what you expected? e.g. are the < etc in escape code?

Perhaps you should try .replace("&quot;","'").replace("&lt;","<").replace("&gt;",">") on dataC.get(0).get("tozih")

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.