diff options
author | zotlabs <mike@macgirvin.com> | 2018-11-04 13:58:02 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-11-04 13:58:02 -0800 |
commit | af82aab3a649c4384f1d28f76451c5830ddaeb26 (patch) | |
tree | 997ad87ce6a36cb5639e6c40a35ac73aee0a1cbd /Zotlabs/Module/Linkinfo.php | |
parent | 51b4b6216f902464f80b088666f3c91af0d3f333 (diff) | |
parent | de0fab78edd469ee0b6572e157e901ccf0078c6a (diff) | |
download | volse-hubzilla-af82aab3a649c4384f1d28f76451c5830ddaeb26.tar.gz volse-hubzilla-af82aab3a649c4384f1d28f76451c5830ddaeb26.tar.bz2 volse-hubzilla-af82aab3a649c4384f1d28f76451c5830ddaeb26.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into xdev_merge
Diffstat (limited to 'Zotlabs/Module/Linkinfo.php')
-rw-r--r-- | Zotlabs/Module/Linkinfo.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index dbed571d4..7c7dc0e88 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -228,8 +228,13 @@ class Linkinfo extends \Zotlabs\Web\Controller { $header = $result['header']; $body = $result['body']; + + // Check codepage in HTTP headers or HTML if not exist + $cp = (preg_match('/Content-Type: text\/html; charset=(.+)\r\n/i', $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', (preg_match('/meta.+content=["|\']text\/html;\s+charset=([^"|\']+)/i', $body, $o) ? $o[1] : 'UTF-8')); + $body = mb_convert_encoding($body, 'UTF-8', $cp); $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8"); $doc = new \DOMDocument(); |