note 79579 added to function.header

From: Date: Tue, 04 Dec 2007 13:19:57 +0000
Subject: note 79579 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-132790@lists.php.net to get a copy of this message
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.. ---- Server IP: 85.196.20.153 Probable Submitter: 150.140.187.184 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/79579 Del: integrated -- https://master.php.net/note/delete/79579/integrated Del: useless -- https://master.php.net/note/delete/79579/useless Del: bad code -- https://master.php.net/note/delete/79579/bad+code Del: spam -- https://master.php.net/note/delete/79579/spam Del: non-english -- https://master.php.net/note/delete/79579/non-english Del: in docs -- https://master.php.net/note/delete/79579/in+docs Del: other reasons-- https://master.php.net/note/delete/79579 Reject -- https://master.php.net/note/reject/79579 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132790) next »