xml parsing - VBA force SAX to encode UTF-8 and indent -


i'm writing vba export xml. use saxxmlreader because need pretty indented output.

this want declaration like:

<?xml version="1.0" encoding="utf-8"?> 

this turns out as:

<?xml version="1.0" encoding="utf-16" standalone="no"?> 

why sax ignoring encoding selection , how force use 8.

sub xml_format_indent_save(xmldoc1 msxml2.domdocument60, stroutputfile string)     dim xmlwriter msxml2.mxxmlwriter60     dim strwhole string      set xmlwriter = createobject("msxml2.mxxmlwriter")     xmlwriter.omitxmldeclaration = false     xmlwriter.indent = true     xmlwriter.encoding = "utf-8"     createobject("msxml2.saxxmlreader")         set .contenthandler = xmlwriter         .putproperty "http://xml.org/sax/properties/lexical-handler", xmlwriter         .parse xmldoc1     end     strwhole = xmlwriter.output     exportstringtotextfile stroutputfile, strwhole end sub 

from read in post, need set .byteordermark either true or false, otherwise .encoding ignored.