Menu

#142 Charset CP1252 not detected

closed
charset (7)
2019-04-20
2014-08-16
No

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)

Discussion

  • LogMANOriginal

    LogMANOriginal - 2019-04-18
    • Labels: --> charset
     
  • LogMANOriginal

    LogMANOriginal - 2019-04-20
    • status: open --> closed
    • assigned_to: LogMANOriginal
     
  • LogMANOriginal

    LogMANOriginal - 2019-04-20

    Thanks for providing example code. This is fixed in [30757f] (see commit message for more details).

     

    Related

    Commit: [30757f]


Log in to post a comment.

MongoDB Logo MongoDB