There is a string I'm trying to output in an htmlencoded way, and the htmlentities()
function always returns an empty string.
I know exactly why it does so. Well, I am not running PHP 5.4 I got the latest PHP 5.3 flavor installed.
The question is how I am gonna be able to htmlencode a string which has invalid code unit sequences.
According to the manual, ENT_SUBSTITUTE
is the way to go. But this constant is not defined in PHP 5.3.X.
I did this:
if (!defined('ENT_SUBSTITUTE')) {
define('ENT_SUBSTITUTE', 8);
}
still no luck. htmlentities
is still returning empty string.
I wanted to try ENT_DISALLOWED
instead, but I cannot find its corresponding long value for it.
So my question is two folded
What's the constant value of PHP 5.4's
ENT_DISALLOWED
?How do I make sure that a string containing non UTF-8 characters (such as the smart quotes), can be cleared out of them? - Not just the smart quotes but anything that causes
htmlentities()
to return blank string.