From 74c72b5cab5e097ee610feca7d57e25fba11d626 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 23 May 2011 18:16:41 +0200 Subject: check if the charset parameter really exists --- www/ajaxGetTitle.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'www/ajaxGetTitle.php') 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>/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")) { -- cgit v1.2.3