Recent

Author Topic: XML set encoding  (Read 1280 times)

superc

  • Full Member
  • ***
  • Posts: 241
XML set encoding
« on: October 19, 2018, 09:40:11 am »
Hello,
I'm using XMLWrite unit for write an XML file;

Code: Pascal  [Select][+][-]
  1. var
  2.   Doc: TXMLDocument;                                
  3.   RootNode, parentNode, nofilho: TDOMNode;                  
  4. begin
  5.   try
  6.     // Create a document
  7.     Doc := TXMLDocument.Create;
  8.  
  9.     // Create a root node
  10.     RootNode := Doc.CreateElement('init');
  11.     Doc.Appendchild(RootNode);  
  12.  
  13.     writeXMLFile(Doc, 'test.xml');
  14.  

the encoding is UTF8, and i must use ISO-8859-1;
my question is:
how set different encode?

thanks in advance.




superc

  • Full Member
  • ***
  • Posts: 241
Re: XML set encoding
« Reply #1 on: October 19, 2018, 11:17:40 am »
OK I found this comment inside XMLWrite unit:

  // Here we ignore doc.xmlEncoding and write a fixed utf-8 label,
  // because it is the only output encoding currently supported.
  WriteXMLDecl(TXMLDocument(node).XMLVersion, 'utf-8', (ord(TXMLDocument(node).XMLStandalone)-1) or 1);   


perfect ....

 

TinyPortal © 2005-2018