Release 0.1.5 had 12 kinds of trouble because of Byte-Order Mark

by Tim Bednar on September 19, 2008 » Add the first comment.

Okay, I am making some significant improvements to Ashford as a WordPress Theme framework. In my next release 0.1.5:

  • Subthemes (a.k.a. child themes) are added using the little discussed “Template:” setting in style.css. Special thanks to Op111.net
  • Sandbox “class-generating function” combined with 960 Grid System to make Ashford a killer WordPress framework for developers

In this process, I studied a couple WordPress frameworks namely Sandbox and Thematic. In doing so I used some of their code which had been encoded as UTF-8 which is cool, but these files also included Byte-Order Mark (BOM).

The code is awesome but PHP does not like BOM. This issue showed as an unwanted line break at the top of my page. Thinking that I messed up the CSS, I lost a few hours going through my CSS and loading previous releases of Ashford and doing countless Diffs.

Then I ran it through the HTML validator and it logged at error in my DOCTYPE saying that Content “” is not allowed in prolog.

After much frustration, I learned that my new function.php file was including two PHP files that were saved including Byte-Order Mark. So the headers where messed up causing the unwanted line break at the top of the page.

I use Notepadd++ and turned of BOM and resaved the files. Unfortunately, this does not kill BOM. I had to open Dreamweaver save the code as text files then change them to PHP then delete the files from the server and re-upload.

However, it is all worth it. The next release will have killer improvements.

Find more like this: Other ,

Share this post

Add your comment »