Don't try to sanitize input. Escape output.
Why you should escape output correctly, but generally not sanitize user input.
Source: benhoyt.com
Fast, Ad-Free News Updates
Stay updated with breaking news from Stack Exchange. Real-time updates on events, politics, business and more.