Global htmlentities ENT_COMPAT setup

129 views Asked by At

When moving from PHP 5.3 to 5.4, there is a change on htmlentities() function behavior. Accented words disappear when using echo htmlentities($var);. It is necessary to use echo htmlentities($var,ENT_COMPAT,"ISO-8859-1");.

Is there an option to set a global parameter for every time htmlentities is called to use ENT_COMPAT "ISO-8859-1"?

1

There are 1 answers

1
khaliq On

Why don't you create function for this

function escape($var)
{
 return htmlentities($var, ENT_QUOTES, "ISO-8859-1"));
}