Removed quirky decoding stuff.

This commit is contained in:
flash 2023-10-21 14:39:23 +00:00
parent ac021d7409
commit 1f256a40ca

View file

@ -151,8 +151,6 @@ final class WebLookup implements \Uiharu\ILookup {
$titleTag = $document->getElementsByTagName('title');
foreach($titleTag as $tag) {
$content = trim(mb_convert_encoding($tag->textContent, 'utf-8', $charSet));
if(strtolower($charSet) === 'utf-8' && mb_detect_encoding($decoded = utf8_decode($content)) === 'UTF-8')
$content = $decoded;
$siteInfo->title = $content;
break;
}
@ -170,11 +168,6 @@ final class WebLookup implements \Uiharu\ILookup {
if(empty($nameAttr) || empty($valueAttr))
continue;
if(strtolower($charSet) === 'utf-8' && mb_detect_encoding($decoded = utf8_decode($nameAttr)) === 'UTF-8')
$nameAttr = $decoded;
if(strtolower($charSet) === 'utf-8' && mb_detect_encoding($decoded = utf8_decode($valueAttr)) === 'UTF-8')
$valueAttr = $decoded;
switch($nameAttr) {
case 'og:title':
case 'twitter:title':