PHP HtmlEntities for UTF-8 Characters

Written by

in

,

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');

Comments

2 responses to “PHP HtmlEntities for UTF-8 Characters”

  1. jason Avatar
    jason

    Hi Xrvel

    im looking for a programmer to write a word press plug-in for me . please email if you are available.. best wishes Jason

  2. Anime Feed Avatar
    Anime Feed

    great job 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *