note 79579 deleted from function.header by tularis

From: Date: Fri, 04 Apr 2014 11:28:52 +0000
Subject: note 79579 deleted from function.header by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199162@lists.php.net to get a copy of this message
Note Submitter: henfiber at gmail dot com ---- Is there a serious problem with utf8 encoding? Answer: no- utf8 with bom is a problem.. I spent about 10 hours trying every tip or fix suggested by users to fix the problem with " headers already sent ". Finally I found the problem with a hex editor. As it is previously mentioned header() should be the first statement. Moreover php opening and closing tags should be clean of spaces: So something like this should work: <?php header('something ..'); ?> I had applied an authentication scheme to my pages using sessions. The encoding of my files was "utf-8". Though I tried cleaning everything about spaces,tabs and other dirt through my code, I kept getting these " headers already sent errors..". The problem was in utf-8 encoding ( I don't mean the meta:http-equiv=" charset='utf-8' tag but the actual encoding of my file.) When I changed to ANSI everything worked. Actually the utf-8 encoding added three characters at the start of my file : ο»Ώ. This is called bom in utf-8. So if you are going to use utf-8 encodings to your pages and need to put php header code in these pages choose to save "utf8 without bom". (I hope your editor has such an option - I use notepad++ in win32 ) Hope it helps..

« previous php.notes (#199162) next »