Update the serialization functions.  These will now set the xml declaration to use the original encoding for a document that was parsed as opposed to being built from scratch.