Question : DUMB question: Can't get htmlspecialchars_decode (or entity) to work...

Either I'm not using the right function or there's something I'm missing. But I don't understand why the following code does NOT replace the special chars (or entities?) by what they should be:

(I added spaces before the "&" to make sure your computer wouldn't block them)

$t = "I want the world& #8217;s coolest boat & #8212; valued at $99.9 millions & #8212; to sail around the world.";
$tres = html_entity_decode ($t);
echo $tres;

Or...

$t = "I want the world& #8217;s coolest boat & #8212; valued at $99.9 millions & #8212; to sail around the world.";
$tres = htmlspecialchars_decode ($t);
echo $tres;

It does NOT convert the & #8217; back to a single quote... etc...

When I run this code and view the source, the special characters are still in the form of codes...

Answer : DUMB question: Can't get htmlspecialchars_decode (or entity) to work...

I don't think it's possible to replace all.  Refer to this page: http://www.alanwood.net/unicode/index.html  Note that there are now over 100,000 possible characters with encodings like you are seeing.  For most of those, the coding you're seeing is the correct way to include them in a web page because they don't have Latin equivalents.  If you go thru the character lists, you'll probably find that your computer and browser don't actually support all of them anyway.
Random Solutions  
 
programming4us programming4us