PHP HtmlEntities for UTF-8 Characters

If you just use simple PHP htmlentities function with one argument, you will notice that when you pass string that contains UTF-8 characters, the result is incorrect leaving you with some incorrect characters on the result. To use it correctly, use this code 🙂 htmlentities($your_string, ENT_COMPAT, ‘UTF-8’);