Fixed a bug that was causing the wrong encoding to be used when converting a DOM Document to a String.