Reputation: 6748
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!
Upvotes: 0
Views: 623
Reputation: 527378
You need to pass ENT_QUOTES
as the quote_style parameter:
http://php.net/manual/en/function.html-entity-decode.php
Otherwise, html_entity_decode()
defaults to ENT_COMPAT
which converts double-quote characters but doesn't touch single-quote characters (which is what '
is - a single quote).
$result = html_entity_decode($input_string, ENT_QUOTES);
Upvotes: 2