I've been working on a forum-like system, which does not allow for HTML formatting. The method I currently use is to escape HTML entities before they get inserted into the database. I've been told (in relation to XSS vulnerabilities) that I should insert the raw comment into the database, and escape HTML entities upon output.
Other questions here I've seen on the matter seem to imply that the HTML would/could still be used for formatting, thus I'm asking for a case where the HTML would not be used at all.