diff options
author | Max Kostikov <max@kostikov.co> | 2018-11-02 10:52:52 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2018-11-02 10:52:52 +0100 |
commit | 32c4614a324f07133fee1163fff77aab5e9cc258 (patch) | |
tree | 691fd87404569f1c2e01c7dd47e5178ed1e7d408 /Zotlabs/Module/Linkinfo.php | |
parent | 24ae6c91ead39501c69838738db1b28eff222ea7 (diff) | |
download | volse-hubzilla-32c4614a324f07133fee1163fff77aab5e9cc258.tar.gz volse-hubzilla-32c4614a324f07133fee1163fff77aab5e9cc258.tar.bz2 volse-hubzilla-32c4614a324f07133fee1163fff77aab5e9cc258.zip |
Workaround for incorrect ISO-8859-5 encoded content conversion
Diffstat (limited to 'Zotlabs/Module/Linkinfo.php')
-rw-r--r-- | Zotlabs/Module/Linkinfo.php | 7 |
1 files changed, 5 insertions, 2 deletions
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(); |