views:

30

answers:

2

Hello , I think i encountered a PHP bug When my header file is in UTF-8 encoding and my index.php file is in ANSI PHP gives " headers already sent " error . Is this normal ? and if yes , can you explain why ?

+2  A: 

Maybe your editor is writing a UTF-8 BOM to the beginning of the "header" file, and PHP, not knowing what the BOM is, considers it as data to output and does that annoying thing PHP does?

There's a long-standing WONTFIX bug on PHP's mis-handling of the BOM. Probably your only workaround is to find an editor that writes UTF-8 without it (which, actually, is most of them.)

hobbs
+1  A: 

I've seen this before. Somewhere outside of the the encoding is generating some whitespace. It was a pain and a half to track down.

zacharydanger