I’m trying to parse a string from a French text, and I’m using both htmlspecialchars and html_entity_decode– but certain characters aren’t getting properly converted.
Any ideas?
Here’s the code:
html_entity_decode(htmlspecialchars_decode($this->string($tstring))); // returned from web service
In particular, the entity that isn’t decoding is this one:
'
Thanks for any help!
You need to pass
ENT_QUOTESas the quote_style parameter:http://php.net/manual/en/function.html-entity-decode.php
Otherwise,
html_entity_decode()defaults toENT_COMPATwhich converts double-quote characters but doesn’t touch single-quote characters (which is what'is – a single quote).