I was looking at some discussions on disinfecting HTML markup strings to redisplay on a page (e.g. blog comments). Previously, I only unilaterally avoided markup for re-rendering.
Does anyone know if there are any solutions that go beyond just deleting "unsafe" tags?
What to do if markup is invalid? For example, how do you prevent and do not close the <b> tag in bold before all the text that follows it on the page?
Stackoverflow seems to handle this.
Unclosed tag 'b' example
Thanks.
source share