aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Linkinfo.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-14 19:52:05 +0000
committerMario <mario@mariovavti.com>2024-01-14 19:52:05 +0000
commitc4c4ab2f3de5b71faa5f739e18eabb14bb108929 (patch)
tree424a70acafdd0297850d6fc039103b366633f09c /Zotlabs/Module/Linkinfo.php
parentaec3247952caff0bbfe017323bee319ceb4327e3 (diff)
downloadvolse-hubzilla-c4c4ab2f3de5b71faa5f739e18eabb14bb108929.tar.gz
volse-hubzilla-c4c4ab2f3de5b71faa5f739e18eabb14bb108929.tar.bz2
volse-hubzilla-c4c4ab2f3de5b71faa5f739e18eabb14bb108929.zip
fix regression in commit b05b7561
Diffstat (limited to 'Zotlabs/Module/Linkinfo.php')
-rw-r--r--Zotlabs/Module/Linkinfo.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index 5c0ca32af..081966dba 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -291,14 +291,15 @@ class Linkinfo extends \Zotlabs\Web\Controller {
// 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');
+ if(empty($cp)) {
+ $cp = (preg_match('/meta.+content=["\']text\/html; charset=([^"\']+)/i', $body, $o) ? $o[1] : 'AUTO');
+ }
- // mb_convert_encoding() is deprecated
- //$body = mb_convert_encoding($body, 'UTF-8', $cp);
- //$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
+ $body = mb_convert_encoding($body, 'UTF-8', $cp);
- $body = mb_encode_numericentity($cp, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
+ // Handling HTML entities via mbstring is deprecated
+ //$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
+ $body = mb_encode_numericentity($body, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
$doc = new \DOMDocument();
@$doc->loadHTML($body);