brownieable — 2013-01-01T08:20:45-05:00 — #1
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
lemon_juice — 2013-01-01T12:19:41-05:00 — #2
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.
brownieable — 2013-01-01T15:59:20-05:00 — #3
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.