From 2f3b4a7aafeaf92d9937aa71acce8e777c46f63d Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 3 Nov 2018 00:01:15 +0100 Subject: Update Linkinfo.php --- Zotlabs/Module/Linkinfo.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index 6b067f6fd..8ce82f7e9 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -229,10 +229,10 @@ class Linkinfo extends \Zotlabs\Web\Controller { $header = $result['header']; $body = $result['body']; - // Check codepage in page or in HTTP headers if not exist - $cp = (preg_match('/meta.+content=["|\']text\/html; charset=([^"|\']+)/i', $body, $o) ? $o[1] : ''); - if(empty($cp) || strtoupper($cp) == 'ISO-8859-5') - $cp = (preg_match('/Content-Type: text\/html; charset=(.+)/im', $header, $o) ? $o[1] : 'AUTO'); + // Check codepage in HTTP headers or HTML if not exist + $cp = trim((preg_match('/Content-Type: text\/html; charset=(.+)/im', $header, $o) ? $o[1] : '')); + if(empty($cp)) + $cp = (preg_match('/meta.+content=["|\']text\/html; charset=([^"|\']+)/i', $body, $o) ? $o[1] : 'AUTO'); $body = mb_convert_encoding($body, 'UTF-8', $cp); $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8"); -- cgit v1.2.3