Now makes use of the encoding in the xml declaration.