]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
check if the charset parameter really exists
authorChristian Weiske <cweiske@cweiske.de>
Mon, 23 May 2011 16:16:41 +0000 (18:16 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 23 May 2011 16:16:41 +0000 (18:16 +0200)
www/ajaxGetTitle.php

index b4f44ca0da68440a6b96e38597e93c94d7fe761c..8e5d92cdeb0f269bf68800a4be3ca88ab3bbad14 100644 (file)
@@ -38,9 +38,12 @@ function getTitle($url) {
                preg_match_all('/<title>(.*)<\/title>/si', $html, $matches);
                $title = $matches[1][0];
 
+               $encoding = 'utf-8';
                // Get encoding from charset attribute
                preg_match_all('/<meta.*charset=([^;"]*)">/i', $html, $matches);
-               $encoding = strtoupper($matches[1][0]);
+               if (isset($matches[1][0])) {
+                       $encoding = strtoupper($matches[1][0]);
+               }
 
                // Convert to UTF-8 from the original encoding
                if (function_exists("mb_convert_encoding")) {