Of course this has been asked before and have searched for solutions, all which have not worked thus far. I want to change out the TM symbol and the ampersand to their html equivelents by using htmlentities
or htmlspecialchars
:
$TEST = "Kold Locker™ & other stuff";
echo "ORGINIAL: " . $TEST . "<BR/>";
echo "HTML: " . htmlentities($TEST, ENT_COMPAT, 'UTF-8');
This displays:
ORGINIAL: Kold Locker™ & other stuff
HTML:
I have also tried it with htmlspecialchars
and the second parameter changed with the same result.
What am I missing that others have claimed worked in other solutions?
UPDATE: I tried just displaying utf8_encode($TEST)
and it displayed HTML: Kold Locker™ & other stuff
1
and set error_reporting toE_ALL
. You're likely getting an error message. – Scoophtmlentities
nothtmlspecialchars
. – Ramadanhtmlentities($TEST, ENT_COMPAT | ENT_IGNORE, "UTF-8");
– RamadanHTML: Kold Locker & other stuff
– Urita