I'm just about ready to go live and this is driving me nuts. I was doing some final browser compatibility testing last night and I realized some of the weirdness I was experiencing with IE (specifically, margin:auto not centering certain divs) was due to something sending it into quirks mode. I immediately ran it through the w3c validator and fixed all the usual minor stuff. But there was one obscure error that took me a while to figure out.
Code:
Error - Line 1 column 0: character "" not allowed in prolog.
���<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
After some extensive googling, I discovered that this can be caused by Unicode documents being saved with a three character Byte Order Mark at the beginning of the file. This can cause problems in PHP files. At first I thought it must be html_header.php, since the BOM seems to be appearing before the DOCTYPE declaration, but it doesn't seem to be the case. I've opened every custom template file, /index.php, and every other file I could think of in BBEdit and manually switched the file type to "UTF-8, no BOM." Still, I have the error. I've run them through a batch text encoding switcher app. Still no dice.
My setup is like this: My store is served as UTF-8, and my database is encoded in UTF-8. The store has a Japanese and an English side - I use two slightly different versions of the same template for each. The weird thing is that the Japanese side validates. I tried temporarily replacing all the english template files with the Japanese ones to see if that fixed it. That didn't work, so it must be elsewhere. The next most likely place is the language files, but I've converted and replaced all the language files as well without success.
I have no idea where this is coming from, but it's a critical bug.
Bookmarks