diff --git a/src/DOMNodeComparator.php b/src/DOMNodeComparator.php index 38f30f1..ae5da1d 100644 --- a/src/DOMNodeComparator.php +++ b/src/DOMNodeComparator.php @@ -71,7 +71,10 @@ private function nodeToText(DOMNode $node, bool $canonicalize, bool $ignoreCase) { if ($canonicalize) { $document = new DOMDocument; - @$document->loadXML('ownerDocument->encoding . '"?>' . \PHP_EOL . $node->C14N()); + @$document->loadXML( + 'ownerDocument->encoding ?: 'UTF-8') . '"?>' . \PHP_EOL + . $node->C14N() + ); $node = $document; }