delphi - How do I get encoding = "utf-8"?> in a txmldocument.xml? -


this doesn't work me in delphi xe2.

var   xmldoc : ixmldocument; begin   xmldoc := newxmldocument;   xmldoc.active := true;   xmldoc.version := '1.0';   xmldoc.encoding := 'utf-8';   xmldoc.options := [donodeautoindent];   memo1.text := xmldoc.xml.text; 

i still not encoding="utf-8"?> in resulting doc. if

  xmldoc.encoding := 'utf-16'; 

then encoding="utf-16"?> in resulting doc.

any ideas? anyone?

utf-8 xml's default encoding when no encoding attribute or bom present indicate different encoding being used. underlying xml engine knows that, omit generating encoding attribute utf-8 when knows safe so.

afaik, there no way force ixmldocument.xml.text or ixmldocument.savetoxml(var xml: domstring) or ixmldocument.savetoxml(var xml: widestring) generate encoding attribute utf-8. however, ixmldocument.savetoxml(var xml: utf8string) , ixmldocument.savetostream() generate encoding attribute utf-8.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -