EldoS | Feel safer!

Software components for data protection, secure storage and transfer

XML Doc SaveToStream

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#7982
Posted: 10/29/2008 06:16:46
by Matjaz Urank (Standard support level)
Joined: 10/29/2008
Posts: 2

Hi,

when I'm saving XML Document to file using ElXMLDOMDocument.SaveToStream in UTF-8 format, library autimatically adds Byte Order Mark (byte sequence EF BB BF) at the beginning of the file. I know that most of the Windows programs do that, but this is not really a standard (http://en.wikipedia.org/wiki/Byte_Order_Mark). Is there a simple way to suppress writing BOM at the begining of file for UTF-8 format?

I'm using XMLBox version 5.0.104

Thanks,

Matjaz
#7983
Posted: 10/29/2008 11:45:24
by Dmytro Bogatskyy (EldoS Corp.)

Quote
Is there a simple way to suppress writing BOM at the begining of file for UTF-8 format?

There is no option for this.
The simplest way is to write descendant class of TElXMLUTF8Codec and pass instance of it to SaveToStream method (third parameter).

E.g.
Code
  TMyXMLUTF8Codec = class(TElXMLUTF8Codec)
  public
    procedure WriteStartup; override;
  end;

procedure TMyXMLUTF8Codec.WriteStartup;
begin
  fCharset.Reset;
  // fCharset.WriteFileHeader; // writing BOM
  fCharset.WriteLineBegin;
end;
#7990
Posted: 10/30/2008 05:26:46
by Matjaz Urank (Standard support level)
Joined: 10/29/2008
Posts: 2

Thank you for your answer. That works great.

Tnx, Matjaz


Reply

Statistics

Topic viewed 1619 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!