tags:

views:

60

answers:

2

Hi, For some reason this html page will not load the css file AND displays as gibberish in ff3.6.6 on mac, fine in Safari. http://www.mainstayprojects.com/teardrop.html

The same code works fine on another page: www.mainstayprojects.com/

The path to the css file is correct and all the html and css validates. I'm at a loss as to what to try next!?

Help!

+3  A: 

Basically, you have a character encoding mismatch, which is causing a no parse mode declaration error.

Specifically the browser is seeing a funny character before the DOCTYPE, since the browser is assuming the wrong character encoding, which is causing it to completely miss the DOCTYPE declaration (thanks for the clarification David):

character "þ" not allowed in prolog

In XHTML the encoding declaration for your HTML header of utf-16 is

<meta http-equiv="Content-Type" content="text/html; charset=utf-16" /> 

Currently, in your HTML header you are declaring utf-8

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

You have a non UTF-8 character on line 129, so you cannot do this. Additionally, it doesn't match with your files encoding or what your server is claiming the file is.

In your CSS, you should declare the encoding too. This goes on the very first line, before anything else.

@charset "utf-16";
Peter Ajtai
The þ is just a side effect of trying to treat UTF-16 as a different encoding.
David Dorward
@David thanks, I didn't quite get what was causing that error.
Peter Ajtai
+5  A: 

The HTML document is encoded as UTF-16 but the server claims it is ISO-8859-1, meanwhile the CSS appears to be ISO-8859-1 also, but the server has nothing to say about the encoding it is using.

To resolve this:

  1. Pick an encoding (UTF-8 is a good choice but see http://www.joelonsoftware.com/articles/Unicode.html )
  2. Configure your editor to save in it ( http://www.w3.org/International/questions/qa-setting-encoding-in-applications )
  3. Configure your server to mention it in the content-type header ( http://www.w3.org/International/O-HTTP-charset )
David Dorward
Thanks guys, this has really helped. I've managed to just about fix the problems. Just a case of rooting out the few rogue characters!
Kernowkid