X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FLinkUtils.php;h=2df76ba8a4b457f4867efb9e960b7242d55a614d;hb=47be06098396b5eef35234b88227d64ab81bd988;hp=26dd6b6794c402464c007b647a5cd5dbe9a9b19f;hpb=fc17813bd1888aeace1e74a15c10ba79043a87f8;p=github%2Fshaarli%2FShaarli.git diff --git a/application/LinkUtils.php b/application/LinkUtils.php index 26dd6b67..2df76ba8 100644 --- a/application/LinkUtils.php +++ b/application/LinkUtils.php @@ -9,8 +9,8 @@ */ function html_extract_title($html) { - if (preg_match('!(.*)!is', $html, $matches)) { - return trim(str_replace("\n", ' ', $matches[1])); + if (preg_match('!(.*?)!is', $html, $matches)) { + return trim(str_replace("\n", '', $matches[1])); } return false; } @@ -70,7 +70,7 @@ function headers_extract_charset($headers) function html_extract_charset($html) { // Get encoding specified in HTML header. - preg_match('#/]+)"? */?>#Usi', $html, $enc); + preg_match('#/]+)["\']? */?>#Usi', $html, $enc); if (!empty($enc[1])) { return strtolower($enc[1]); }