Hi everyone.
I'm struggling to figure this one out and hope someone can help. I completely understand the principles of this function - however - I am using pre-defined strings and entering them into a database.
For some reason whenever there is a single quote, the pre-defined string uses ' instead of '
I am trying to parse this, decode the string, and use htmlspecialchars function to convert it and enter into my database, however htmlspecialchars_decode does not seem to recognise ' - only the likes of " and &
In order to convert: Sam's House -> Sam's House -> Sam's House I have tried using:
$str = "Sam's house";
$str = htmlspecialchars_decode($str);
$new = htmlspecialchars($str, ENT_QUOTES);
However, this returns: Sam's House.
The decoding function seems to fail.
any ideas?
Much appreciated in advance!