-1

Symbols not getting in android WebView

For More Info please see the drive link

https://drive.google.com/open?id=17PXFPJnVYkuGA_fkQPxskeIaw8AlzkcD

binding.tvQuestion.loadDataWithBaseURL("", questionlist.title, "text/html", "UTF-8", "");
binding.tvQuestion.getSettings().setJavaScriptEnabled(true);

How can I show the special characters/unicode characters?

ankuranurag2
  • 2,300
  • 15
  • 30
P ZOMANT
  • 1
  • 2

1 Answers1

1

Try

Setting the correct encoding in html file as a meta tag

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

Android Load Data

webView.loadData("", "text/html; charset=utf-8", "UTF-8");

Android Setting

WebSettings webSettings = webView.getSettings();
webSettings.setDefaultTextEncodingName("utf-8");  
webView.loadData("", "text/html; charset=utf-8", null);

Replace Special Character if you not usable

mwebView.loadData(URLEncoder.encode(data, "utf-8").replaceAll("\\+"," "), "text/html", "utf-8");
Farid Haq
  • 3,728
  • 1
  • 21
  • 15