Why does UTF-8 encoding causes certain errors?

I am reading ‘PHP,MySQL Novice to Ninja book by Kevin Yank’ and in there he uses a separate file for connecting to the database which I just include into the code when needed which I suppose is a common practice.
My problem is that when I use UTF-8 encoding for that separate file used to connect to the database, I get errors like that Cannot modify header information - headers already sent by. However, if I change encoding back to ANSI, the problems disappear. How is that possible and what difference does encoding format make anyway?
Thank you for the answers :wink:

Most probably your editor adds a BOM to the beginning of the file when you save it as UTF-8. Set your editor to not use BOM and your problem should disappear.

Yep, it helped to solve the problem, thanks. Apparently, BOM is just an extra byte sequence at the beginning of the file. I use Notepad++, so UTF-8 with BOM comes as a default. I found out that according to the Unicode standard, the BOM for UTF-8 files is not even commended which begs a question, why such a popular editor such as Notepad++ would leave it like that? I know it’s not a big deal or anything but just got me curious.