save: Rework encoding setup Always set up encoding in xmlDocContentDumpOutput. Refactor and simplify some code.