Removed doctype and fixed entities for text/plain
authorAlexander Ebert <ebert@woltlab.com>
Mon, 1 Aug 2016 15:07:05 +0000 (17:07 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 1 Aug 2016 15:07:05 +0000 (17:07 +0200)
Fixes #2069

wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php
wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php

index 57a7f1466da086b56f86c31d2299dd55e0424d51..94884bd4c9632af6fe83832662104f257bb8c54e 100644 (file)
@@ -72,6 +72,7 @@ abstract class AbstractHtmlNodeProcessor implements IHtmlNodeProcessor {
                $html = $this->document->saveHTML($this->document->getElementsByTagName('body')->item(0));
                
                // remove nuisance added by PHP
+               $html = preg_replace('~^<!DOCTYPE[^>]+>\n~', '', $html);
                $html = preg_replace('~^<body>~', '', $html);
                $html = preg_replace('~</body>$~', '', $html);
                
index 175ea2884f077fcb282a0dd36b1b282861849325..b34e21f657c811badecef0a256cc17df828c5acf 100644 (file)
@@ -100,6 +100,7 @@ class HtmlOutputNodeProcessor extends AbstractHtmlNodeProcessor {
                
                if ($this->outputType === 'text/plain') {
                        $html = StringUtil::trim($html);
+                       $html = StringUtil::decodeHTML($html);
                }
                
                return $html;