Skip to content

Commit d0edad0

Browse files
committed
enforce encoding
1 parent 9d53553 commit d0edad0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/XML/DOMDocumentFactory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static function (int $severity, string $message): never {
9191
);
9292

9393
try {
94-
$loaded = $domDocument->createFromString($xml, $options);
94+
$loaded = $domDocument->createFromString($xml, $options, $domDocument->characterSet);
9595
} finally {
9696
restore_error_handler();
9797
}
@@ -213,7 +213,8 @@ public static function normalizeDocument(Dom\Document $doc): Dom\Document
213213
$root->setAttributeNS(C::NS_XMLNS, $name, $value);
214214
}
215215

216-
return Dom\XMLDocument::createFromString($doc->saveXml($doc->documentElement));
216+
$options = self::getDefaultOptions();
217+
return Dom\XMLDocument::createFromString($doc->saveXml($doc->documentElement), $options, $doc->characterSet);
217218
}
218219

219220

0 commit comments

Comments
 (0)