diff options
author | Max Kostikov <max@kostikov.co> | 2018-11-03 00:01:15 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2018-11-03 00:01:15 +0100 |
commit | 2f3b4a7aafeaf92d9937aa71acce8e777c46f63d (patch) | |
tree | 053e12e0acf023164c7594261dc7f4abd2d212ed | |
parent | a9bbe0b12882db9d9c3192c3cd0055a50e9c34d5 (diff) | |
download | volse-hubzilla-2f3b4a7aafeaf92d9937aa71acce8e777c46f63d.tar.gz volse-hubzilla-2f3b4a7aafeaf92d9937aa71acce8e777c46f63d.tar.bz2 volse-hubzilla-2f3b4a7aafeaf92d9937aa71acce8e777c46f63d.zip |
Update Linkinfo.php
-rw-r--r-- | Zotlabs/Module/Linkinfo.php | 8 |
1 files 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"); |