I think the last paragraph should be highlighted.
Do not remove bad things. Permit safe things.
A few weeks ago in a reply to someone in email@example.com on similar topic I wrote:
- There is NO single list of dangerous characters. What
characters are dangerous depends on the action you do with the
- If you or someone else creates a list of suspicious characters
and test whether the data contain any of them, you are NOT safe.
It's for sure you'll forget some character, it's for sure there is
something you've never heard of that can go wrong.
- Always test whether the data DO CONTAIN ONLY ALLOWED
characters. And allow only the characters you must.