When I try to validate xml file with XSD document and the encoding is set in the XML document I get encoding errors in the result.
I am loading XmlDocuments from string so encoding should be ignored.
When I replace encoding with utf-8 everything works
Reproduction
https://github.com/rajzik/libxml-repro