What are those characters at the beginning of Visual Studio auto-generated files?

c#, visual-studio

Solution

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

More info:

- http://en.wikipedia.org/wiki/Byte-order_mark

Problem

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?

Original source