PHP 4 and 5 and UTF-8 BOM issues
handgestrickts favourite source-code-editor is Ultraedit 32. this editor, like many other modern editors, has a good feature to mark files as UTF-8 encoded. this mark is called BOM (byte order mark) and is a 2-4 bytes mark in the beginning of a file, that indicates which Unicode-type is used. what a brilliant idea.
unfortunately PHP 4 and 5 send these marks as output to the browser. so if later you use a session_start()- or header()-function somewhere, you end up with the error message "headers already sent in ...".
after searching the web, we found the solution: PHP 5.2.0 introduces the configure-switch --enable-zend-multibyte. this switch enables PHP to recognize the BOM as what it is. unfortunately you have to recompile PHP.
for people using PHP on windows or others hosting on a shared public webserver, there are other workarounds: the first line in your PHP code should be a comment with a Unicode-character inside, like german "Umlaute", for example. then you save this file as UTF-8 without BOM. the editor should now recognize the special character as UTF-8 encoded and switch to the right encoding.
good news for the future: PHP 6 will have a widespread Unicode-support also enabling this feature by default.

