I want to make this character (′) html entity for storing in my database using php. I am using MySQL databse. I use:
$string = "HTML5′s placeholder Attribute";
$newStr = htmlspecialchars($string, ENT_QUOTES);
echo $newStr;
the above code prints the following
HTML5â?²s placeholder Attribute
How can I make this (′) character an HTML entity?
You need to use
htmlentities()here, as that specific quote thingy does not need escaping normally. And you also need to specifiy the charset, as you otherwise get those Latin-1 equivalent escapes:Should either get you
′or′as result.