a quick fix would be to just rely on the already set $this->xml_print_pi property:
if (!$this->xml_print_pi && $encoding) {
$content = '<?xml encoding="'.$encoding.'">'.$content; // add pi node to make libxml use the correct encoding
$xml_pi_node_added = true;
}
when scraping a website that contains inlined svg graphics, the
loadContent()
function fails to apply the correct encoding as the<?xml version="1.0" encoding="UTF-8"?>
of the inlined graphic is preventing adding of encoding header in https://github.com/Rct567/DomQuery/blob/663dba005225fbe18f5eff38a796801a4af79def/src/Rct567/DomQuery/DomQueryNodes.php#L358a quick fix would be to just rely on the already set
$this->xml_print_pi
property: