Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.NET XmlTextWriter inserting unwanted charactors

Status
Not open for further replies.

Stevoie

Programmer
Jun 7, 2001
68
IE
Hi

I am using the .NET System.Xml.XmlTextWriter class to create some xml files. I noticed that there were three extra charactors at the start of the xml file that i had not requested.

They are: [red][/red]

What i need to know is how to stop the XmlTextWriter from writing these out. They are interfering with my SAX parser.

Thanks,

StevoIE

StevoIE
 
yeah thanks for that.

i changed the encoding to ASCII and it works fine now.



Stevoie
 
Those are the UTF-8 byte-order marks. See:


According the the spec, they're optional. Which means that any XML parser should still be able to read them.

Because you're saying that you don't want them, that's a sign that you're reading the XML file as if it were a plain text file. And that's not best practice -- you should make a point of only using XML-aware readers when loading XML documents and/or strings.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top