Running version lower than PHP 5.3 (and even higher versions, if you believe
the comments at php.net) does not default to UTF-8, but to ISO-8859-1, when
using html_entity_decode(...) function. This creates problems when using
getPlainText(), because it does not take into account the encoding.
What will reproduce the problem?
Just parse something in an encoding other than *YOUR* html_entity_decode(...)
function and it should be easy to see the problems.
What is the expected output? What do you see instead?
Expected output are correctly converted html enttities.
I get an empty string, like " " => ""
but I would expect to see, " " => " "
Which version are you using?
Ganon single file PHP5 (rev. #78)
Please provide any additional information below.
It can be easily resolved by replacing the function getPlainText() from
return preg_replace('`\s+`', ' ', html_entity_decode($this->toString(true,
true, true), ENT_QUOTES));
to
return preg_replace('`\s+`', ' ', html_entity_decode($this->toString(true,
true, true), ENT_QUOTES, $this->getEncoding()));
Original issue reported on code.google.com by
thomas.a...@gmail.comon 19 Jan 2013 at 1:57