I am saving a simple XDocument using
xDoc.Save(result.Filename, SaveOptions.OmitDuplicateNamespaces);
When we open the file and process it on a Windows system (Server2008 or Win7) the xml is correct and processes in the next system correctly.
Howevever, when we move to our production system (unix) the xml fails to read correctly.
When we vi
the resulting file on the unix box there are three leading control characters. Remove these and the xml processes correctly.
I cannot see these characters in Notepad++ (which shows the file as ANSI/UTF8).
Has anyone any idea what these characters ARE, how they get there...and how to either remove them or stop them appearing?
You can omit Unicode BOM, just pass
new UTF8Encoding(false)
to the save method.Something like this (please treat it as pseudo code):