diff --git a/README.md b/README.md index 4bb1f8f..1fb2302 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,12 @@ http://simplehtmldom.sourceforge.net/ Install ------- - composer.phar require - - package name: "sunra/php-simple-html-dom-parser": "dev-master" - + composer.phar +```json +"require": { + "sunra/php-simple-html-dom-parser": "v1.5.0" + } +``` Usage ----- diff --git a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php index 9a7b2f6..c44a604 100644 --- a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php +++ b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php @@ -75,6 +75,11 @@ function file_get_html($url, $use_include_path = false, $context=null, $offset = $contents = file_get_contents($url, $use_include_path, $context, $offset); // Paperg - use our own mechanism for getting the contents as we want to control the timeout. //$contents = retrieve_url_contents($url); + + //convert contents to utf8 + $contents = mb_convert_encoding($contents, 'UTF-8', + mb_detect_encoding($contents, 'UTF-8, ISO-8859-1', true)); + if (empty($contents) || strlen($contents) > MAX_FILE_SIZE) { return false; diff --git a/composer.json b/composer.json index ad1a52a..6d21ae1 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,7 @@ { "name": "sunra/php-simple-html-dom-parser", "type": "library", - "description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.", - "version": "1.5.0", + "description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.", "keywords": ["html", "dom", "parser"], "homepage": "https://github.com/sunra/php-simple-html-dom-parser", "license": "MIT",