felixgirault/essence — pull request #63 by JonathanAquino (2014-05-01 00:37:46+00:00)
Title: Fix encoding issues with OpenGraph descriptions with older Libxml version.

There was an encoding issue in the parsing of OpenGraph tags on certain
websites, for PHP with older Libxml versions. For example:

XG_App::includeFileOnce('/lib/ext/Essence/bootstrap.php');
$essence = \Essence\Essence::instance( );
$media = $essence->embed( 'http://qz.com/204401' );
echo '

' . qh(var_export(iterator_to_array($media), true));

would display some funny characters:

sources tell us theÂ filing of itsÂ IPO papers isÂ days, not weeks, away)

The problem is that older versions of Libxml recognize only

from HTML4, and not the new HTML5 form:

with the result that parsed strings can have funny characters.

The fix is to replace the new form by the old form. For more information, see
"HTML5, character encodings and DOMDocument loadHTML and loadHTMLFile"
http://www.glenscott.co.uk/blog/html5-character-encodings-and-domdocument-loadhtml-and-loadhtmlfile/