I'm building a little file compression system that is supposed to allow grouping a hierarchy of multiple files and then compressing them and the contrary.
For this I don't take care of the file type to keep it generic but I'm getting a problem when the file is an XML file. Actually when I copy an XML file contents into a binary stream it seems to always add 3 bytse at the beginning and I don't know what they're supposed to mean. I wouldn't have gone deeper into this if the XmlTextReader class wouldn't care about it...but it does and crashes telling me it can't find the root element. So for the moment I have to manually check the file to see if it's an xml file or not and remove the three first bytes if it is which is really bad coding...

So if anyone has an idea about this it would really help me. Thanks in advance.

PS: so far I always got the same bytes which are the following characters: . They show up before every xml file I put into the binary stream.

9 Years
Discussion Span
Last Post by GregBlast

Actually it seems to be working (so not to add those three characters) when I set the encoding type to ascii instead of UTF-8. But if I do the same example in "Program.cs" so without having used any forms or the like yet it works fine in UTF-8. So I don't really understand why it acts that way in that particular case...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.