aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Linkinfo.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-11-05 09:55:23 +0100
committerMario Vavti <mario@mariovavti.com>2018-11-05 09:55:23 +0100
commit4830a1559d5ad9f59d809bf3d693592d3f7c8ab2 (patch)
treedb87b400af1f3de1ca01bccef58b0bf4e55b1241 /Zotlabs/Module/Linkinfo.php
parentc8dd516d6c743d0371dc2ccb476eb70bcc17fa0a (diff)
parent92ea3ef72036c39601b69565f3e03fa44ad9aef7 (diff)
downloadvolse-hubzilla-4830a1559d5ad9f59d809bf3d693592d3f7c8ab2.tar.gz
volse-hubzilla-4830a1559d5ad9f59d809bf3d693592d3f7c8ab2.tar.bz2
volse-hubzilla-4830a1559d5ad9f59d809bf3d693592d3f7c8ab2.zip
Merge branch 'dev'
Diffstat (limited to 'Zotlabs/Module/Linkinfo.php')
-rw-r--r--Zotlabs/Module/Linkinfo.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index a0ad17e68..670967370 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();