Menu

#102 Error finding charset in function convert_text

closed
charset (7)
2019-04-20
2012-03-31
Vegetable
No

Hello there! I've trying your library (thanks for the develpment) :D And I've got stuck in a problem. When I use the following lines:

$html = file_get_html($url);
$html->find("div", 0)->plaintext;

(for example) if scrapped page is in ISO-8859-1 and target encoding is UTF-8, chars get wrongly encoded.

I've researched a bit, and managed to solve it. Class simple_html_dom_node has access to simple_html_dom through a reference in its "dom" member. But accessing to "_charset" from "dom", it always return empty. I think that this is because _charset is protected and node class can't read the property.

I've changed the property to public and now everything works fine. Maybe putting a getter would avoid this.

Thanks again for the code! ^_^

Cheers! Tomás García

Discussion

  • LogMANOriginal

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

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

    LogMANOriginal - 2019-04-20

    Fixed with [30757f]

     

    Related

    Commit: [30757f]


Log in to post a comment.