From 32c4614a324f07133fee1163fff77aab5e9cc258 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 2 Nov 2018 10:52:52 +0100 Subject: Workaround for incorrect ISO-8859-5 encoded content conversion --- Zotlabs/Module/Linkinfo.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index a0ad17e68..5c3946d4f 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -228,8 +228,11 @@ class Linkinfo extends \Zotlabs\Web\Controller { $header = $result['header']; $body = $result['body']; - - $body = mb_convert_encoding($body, 'UTF-8', (preg_match('/meta.+content=["|\']text\/html;\s+charset=([^"|\']+)/i', $body, $o) ? $o[1] : 'UTF-8')); + + $cp = (preg_match('/meta.+content=["|\']text\/html;\s+charset=([^"|\']+)/i', $body, $o) ? $o[1] : 'AUTO'); + if(strtoupper($cp) == 'ISO-8859-5') + $cp = 'AUTO'; + $body = mb_convert_encoding($body, 'UTF-8', $cp); $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8"); $doc = new \DOMDocument(); -- cgit v1.2.3