views:

96

answers:

2

When Visual Studio generates, e.g., a C# source file, if you edit it in an ASCII text editor, you'll see something that looks like the following character sequence:



Deleting these bytes doesn't seem to harm anything, but why are they put there in the first place?

+3  A: 

That is the Unicode Byte-Ordering-Mark (BOM). I believe Visual Studio by default creates files in the UTF-8 encoding with BOM. If you treat the UTF-8 BOM as ASCII, it will display those characters. http://en.wikipedia.org/wiki/Byte-order_mark

driis
+6  A: 

This is a byte order marker (BOM). It is used to indicate the encoding of the file.

More info:

JaredPar
+1 you were faster!
jdehaan