Forums / Templates, Stylesheets, Page Layout / Hidden BOM throwing IE into quirks mode

Hidden BOM throwing IE into quirks mode

Locked

Started by phreakymonkey on 16 Jul 2007, 7:03 AM · Views: 2,919

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
16 Jul 2007, 7:03 AM
#1
phreakymonkey avatar

phreakymonkey

New Zenner

Join Date:
Jun 2007
Posts:
20
Plugin Contributions:
0

Hidden BOM throwing IE into quirks mode

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.

Error - [I]Line 1 column 0[/I]: character "" not allowed in prolog.[B]
���[/B]<!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](http://en.wikipedia.org/wiki/Bom) 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. :frusty:
16 Jul 2007, 8:37 AM
#2
phreakymonkey avatar

phreakymonkey

New Zenner

Join Date:
Jun 2007
Posts:
20
Plugin Contributions:
0

Re: Hidden BOM throwing IE into quirks mode

Well, I ended up opening three quarters of the files in my zen cart install in a hex editor and found a couple random language files where the extra characters had been added. None of them seemed related, but I reuploaded everything, and that seems to have fixed it.:blush:

16 Jul 2007, 9:34 AM
#3
funkey avatar

funkey

New Zenner

Join Date:
Jul 2005
Posts:
85
Plugin Contributions:
0

Re: Hidden BOM throwing IE into quirks mode

It's possible you are finding an FTP bug, more than a Zen-Cart one.

ASCII mode transfers, especially in FTP clients like CuteFTP for Windows -- seem to mess with the character encoding of the files, UTF-8 to ISO-8859-1 & so forth.

I always make sure ASCII files are transfered in UTF-8 format before I do any uploading -- and haven't had a problem with multi-lingual setups since.