How do I avoid reading the byte order mark (BOM) in a Resources file in Visual Studio?
c#, resources, xml
Solution
They're not spurious. They're the byte order mark indicating UTF-8.
Problem
I am trying to use the Visual Studio editor to create XML files in the Resources area of an Assembly in C#. The files appear perfectly correct in the XML editor and honour my schema (recognising the elements and attributes). However when I try to read them (from the Resources) they fail because they consistently have 3 spurious characters at the start of the file ( or #EF #BB #BF). These characters do NOT appear in the editor but they are there in an external binary editor. When I remove them manualy the files behave properly. What can I do to create XML files reliably in the Resources area? After first 2 replies I modified the question to "How do I read a resources file to avoid including the byte order mark?"