In line 1254, the encoding_list parameter of mb_detect_encoding is defined as array( "UTF-8", "CP1252" ). However, according to http://de2.php.net/manual/de/function.mb-detect-order.php CP1252 is not included in the detectors, and on my system it is also not included in the output of mb_list_encodings(). Therefore, the mb_detect_encoding() call returns an empty string on an CP1252 document.
To make simple_html_doc work correctly, line 1254 has to be changed to
mb_detect_encoding($this->root->plaintext . "ascii", array( "UTF-8", "ISO-8859-1" ) );
(Note that the "$encoding_list = " is not needed as it defines a local variable in the caller's context)
Thanks for providing example code. This is fixed in [30757f] (see commit message for more details).
Related
Commit: [30757f]