summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-05-23 18:16:41 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-05-23 18:16:41 +0200
commit74c72b5cab5e097ee610feca7d57e25fba11d626 (patch)
tree110aa677466a70a577ccd5ec9db60fe8b8138f5e
parent97bba97049eeed2ecec022caa641b50ca507cb72 (diff)
downloadsemanticscuttle-74c72b5cab5e097ee610feca7d57e25fba11d626.tar.gz
semanticscuttle-74c72b5cab5e097ee610feca7d57e25fba11d626.tar.bz2
check if the charset parameter really exists
-rw-r--r--www/ajaxGetTitle.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/www/ajaxGetTitle.php b/www/ajaxGetTitle.php
index b4f44ca..8e5d92c 100644
--- a/www/ajaxGetTitle.php
+++ b/www/ajaxGetTitle.php
@@ -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")) {