Skip to content

Commit 3878490

Browse files
committed
Set encoding to UTF-8 when it is not specified.
Signed-off-by: Duncan Cameron <3147688+bramley@users.noreply.github.com>
1 parent 9a3da4c commit 3878490

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Reader/Reader.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ public static function importString($string)
363363
$disableEntityLoaderFlag = self::disableEntityLoader();
364364
$dom = new DOMDocument();
365365
$status = $dom->loadXML(trim($string));
366+
if ($dom->encoding === null) {
367+
$dom->encoding = 'UTF-8';
368+
}
366369
foreach ($dom->childNodes as $child) {
367370
if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
368371
throw new Exception\InvalidArgumentException(

0 commit comments

Comments
 (0)