Question

in RSS FEED. I am doing like this to supress html characters from string

public void setEncodedContent(String encodedContent) {
    //this.encodedContent = encodedContent;
    String noHTMLString = encodedContent.replaceAll("\\<.*?>","");
    this.encodedContent = noHTMLString;
}

But I am receiving characters like

&#8211 &#8217 &#8221

What is the way to overcome it ?

Regards

Was it helpful?

Solution

This worked for me. Hope will be helpful to readers

public void setEncodedContent(String encodedContent) {
//this.encodedContent = encodedContent;
String noHTMLString = encodedContent.replaceAll("\\<.*?>","");
String yesHTMLString= Html.fromHtml(noHTMLString).toString();
this.encodedContent = yesHTMLString;

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top