What are the good options for restricting the type of html tags that a user is allowed to enter a form field? I would like to be able to do this client side (presumably using JavaScript), the server side in PHP, if it is too heavy for the user's browser, and possibly a combination of both, if necessary.
In fact, I would like users to be able to send data with the same set of tags as in Stackoverflow, plus possibly standard MathML tags. The form should take the text UTF-8, including Asian ideograms, etc.
In the application, the user should be able to send text entries with basic html tags, and these entries should be accessible to (potentially different) users with html displayed in a way that is safe for users. I plan to use htmlspecialchars()it htmlspecialchars_decode()to protect my server side of the server.
Many thanks,
Jdelage
PS: I searched, but could not find this question ...
source
share