aboutsummaryrefslogtreecommitdiffstats
path: root/include/html2plain.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-02-16 12:56:34 +0000
committerMario <mario@mariovavti.com>2021-02-16 12:56:34 +0000
commit3eaf0b7f23aded75894848664420658e429dce5a (patch)
tree244145835f6ed381341c2dee21607422ae36967c /include/html2plain.php
parent76ad2c0fa49e039fb145a89d1e7024ac45702d3b (diff)
downloadvolse-hubzilla-3eaf0b7f23aded75894848664420658e429dce5a.tar.gz
volse-hubzilla-3eaf0b7f23aded75894848664420658e429dce5a.tar.bz2
volse-hubzilla-3eaf0b7f23aded75894848664420658e429dce5a.zip
php8 another fix
Diffstat (limited to 'include/html2plain.php')
-rw-r--r--include/html2plain.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/html2plain.php b/include/html2plain.php
index fde70bd01..91a1f14cb 100644
--- a/include/html2plain.php
+++ b/include/html2plain.php
@@ -102,12 +102,14 @@ function html2plain($html, $wraplength = 75, $compact = false)
{
$message = str_replace("\r", "", $html);
+ $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
- $doc = new DOMDocument();
- $doc->preserveWhiteSpace = false;
+ if(!$message)
+ return;
- $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
+ $doc = new DOMDocument();
+ $doc->preserveWhiteSpace = false;
@$doc->loadHTML($message);
$xpath = new DomXPath($doc);