aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2018-10-23 19:32:36 +0200
committerMax Kostikov <max@kostikov.co>2018-10-23 19:32:36 +0200
commitf180558041507bcc4f80e8f373ca3e6bd635edea (patch)
treef973bb7ead4a6058f513f18570e8d931eeba846a /Zotlabs/Module
parent01e11e904391504417f1a47c4fbb6277c154b5fd (diff)
downloadvolse-hubzilla-f180558041507bcc4f80e8f373ca3e6bd635edea.tar.gz
volse-hubzilla-f180558041507bcc4f80e8f373ca3e6bd635edea.tar.bz2
volse-hubzilla-f180558041507bcc4f80e8f373ca3e6bd635edea.zip
Convert non UTF-8 content on link embeding
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Linkinfo.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index f0d62b5e0..534e5697b 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -228,8 +228,10 @@ class Linkinfo extends \Zotlabs\Web\Controller {
$header = $result['header'];
$body = $result['body'];
-
- $body = mb_convert_encoding($body, 'UTF-8', 'UTF-8');
+
+ $x = preg_match('/<meta\s+http-equiv=.content-type.+; charset=([^"|\']+)/i', $body, $o);
+
+ $body = mb_convert_encoding($body, 'UTF-8', ($o[1] ? $o[1] : 'UTF-8'));
$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
$doc = new \DOMDocument();