Fix XML parsing so that all valid encodings are supported