I have always used simple htmlentities($_POST['string']);
to clean data for any XSS attacks.
Recently I have seen people use this:
htmlentities($_POST['string'], ENT_QUOTES, 'UTF-8');
What is the advantage or purpose of using that over just htmlentities()
.
Also don't know if it is relevant but I use meta UTF-8 always at the top of my pages.