BOM added in EditPad [Lite]

Just writing as a personal note and hopefully as help to others: I’ve just spent quite a few minutes struggling with a deploy package for a PHP site which worked in my machine and not in my co-workers. Debugging the HTTP responses with Fiddler we realized the problem was with the BOM—or Byte Order Mark—, three bytes of non-printing characters that sometimes are added to the beginning of UTF-8 encoded files by some text editors. These are \EF \BB \BF  in hex and usually printed as  when converted to ISO-8859-1 (in UTF-8 only, the Wikipedia article shows the differences among this and other Unicode enconding).

The problem was that a cookie was not being set by the PHP app because the BOM was being sent before the cookies, so the setcookie() function returned false, since it cannot send a cookie after any output has been sent to the browser, because of HTTP protocol restrictions.

We just could not figure out what was causing that, since the exact same set of files was being used in both my machine’s and my co-worker’s installations.

It turned out the problem was in the main configuration file, which had to be edited by him to make the application work on his machine. He used EditPad Lite to alter the configurations, and it seems that, by default, this program does add the BOM to the beginning of UTF-8-encoded files. So, if you use EditPad Lite (or maybe the Pro version), I surely recommend you should change that option upon installation.

One Response to “BOM added in EditPad [Lite]”

  1. #1 rodrigot, Nov 6, 2007, 2:07 pm: ()

    Hooray!

Have your say

Fields marked as * are required. And don't worry: your e-mail address will not be published.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>