jeudi 3 décembre 2015

Escape only non html elements when rendering text file on webpage

I am rendering a text file on webpage inside <"pre> tags. Right now i have encoded the input file so that < is encoded as &lt and > as &gt. But the problem comes when text file has valid html tags like <"a href=......>hello<"/a>. In this case even the html tags are displayed as plain text not html elements. Is there a reliable way to display html elements as it is while escaping the invalid tags?

Aucun commentaire:

Enregistrer un commentaire