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

有帮助吗?

解决方案

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;

}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top