HTML entities are not decoded by Html2Text
Status: Beta
Brought to you by:
jhsolorz
Html2Text convert() function does not convert HTML
entities, such as or > to their text
equivalents, so they appear in the converted text. It
is pretty easy to fix,
just call html_entity_decode(). Unfortunately it only
works for PHP >=4.3.0
Logged In: YES
user_id=1148016
Originator: NO
Open html2text.inc and find the line that says "function htmlDecode ($text) {", this is an incomplete function that is meant to decode the HTML entities. For a very strange reason he omitted this and put in a comment saying "// TBD" ("to be done"). The only explanation I can think of is that he wanted to write his own HTML-entity-to-ascii converter. Whatever his reasons may be, PHP has its own function for that so just add a line BEFORE "return $text" saying "$text = html_entity_decode($text);".
The result looks like this:
function htmlDecode ($text) {
$text = html_entity_decode($text);
return $text;
}
And his old, empty function looked like this:
function htmlDecode ($text) {
// TBD
return $text;
}
Best Regards