I have WebViewusing the following code:
WebView
WebView webView = new WebView(cont); webView.loadData("Red 20%", "text/html", "utf-8");
The problem has a line. But if I remove the '%' character from the string that displays correctly. What is wrong with the code? How to display "%" in WebView?
Plain:
WebView webView = new WebView(cont); webView.loadData("Red 20%", "text/html", "utf-8");
You can see special characters here: http://www.degraeve.com/reference/specialcharacters.php
URL encodes%
20% 25 must do the trick
TextUtils.htmlEncode() , .
TextUtils.htmlEncode()
WebView webView = new WebView(cont); String s = TextUtils.htmlEncode("Red 20%"); webView.loadData(s, "text/html", "utf-8");
% equevalent, . %,
%
webView.loadData("Red 20%", "text/html", "utf-8");
You can replace "Red 20%" → "Red 20%"