views:

126

answers:

3

Alright, so everything on this website was finished, it all worked, it displayed right enough across all the browsers. For some reason one of the pages isn't styling at all, and the javascript isn't running. The crazy part about this is that every page uses the same CSS file and the same JS file, and the code used across all of them to include the files is exactly the same.

Pages that work fine:
http://dev.sneakyness.com/GLGM/geology.html
http://dev.sneakyness.com/GLGM/quarrying.html
http://dev.sneakyness.com/GLGM/fabrication.html
http://dev.sneakyness.com/GLGM/customercare.html
http://dev.sneakyness.com/GLGM/maintenance.html

Page that is causing me to lose hair:
http://dev.sneakyness.com/GLGM/installation.html

Direct links to CSS, JS:
http://dev.sneakyness.com/GLGM/glgm.js
http://dev.sneakyness.com/GLGM/css/main.css

If you visit any of the working pages, and then visit this one, the styling is all messed up, and the javascript doesn't work. However it looks more styled than unstyled. If you refresh once you are on this page (typical response to a page acting up), the next time it loads it is totally unstyled and javascript does nothing.

If you visit the broken page directly, via new window (new tab doesn't cut it sometimes, idkwtf!) it goes straight the the unstyled uglyness.

In Firebug it gives me some crazy Chinese shit, talking about line one of the JS, which, when commented out, still throws an error. In Webkit browsers you don't get the Chinese stuff, but the same error about line one.

I have no idea. I've tried changing the encoding of the files, but that didn't fix anything/caused more problems. I asked a few developer friends of mine, nobody has a clue. StackOverflow, make me proud, or stupid, whichever works as long as you tell me what in the hell is going on. Be verbose, I want to get to know exactly what caused this to happen very well, because I hate it.


The delinquent page was encoded in UTF-16. Changing it back to UTF-8 fixed it.

A: 

I see the problems you describe. FireBug also shows installation.html is messed up. Try copying a working HTML file (e.g. customercare.html) atop installation.html and see what happens.

Upper Stage
If Guffa is correct, copy customercare.html atop installation.html, edit installation.html, and cut-and-paste old contents into new file. I think that will fix your problem.
Upper Stage
see the above answer about file encodings, we're getting somewhere.
Sneakyness
Yes - it looks good to me now.
Upper Stage
+6  A: 

You have saved the file as UTF-16, so it loads the css files and scripts as UTF-16 also. Save the file as UTF-8 instead.

Guffa
That's what I'd say too, but the odd thing is that it sometimes comes up broken, and sometimes not, when you press reload repeatedly. Also, when I force UTF-16 in Firefox, it still comes up as gibberish. Still, that's the most probable reason.
Pekka
Sneakyness, you should be able to choose an encoding in your editor.
Pekka
Coda has a selector for it, I changed it to UTF-8, now it's entirely in chinese!?!?!
Sneakyness
Works for me now (FF 3.5 on Windows 7).
Pekka
Never seen this before, lol!It's Chinese on FF 3.5.6 on Windows XP
Harmen
Works for me now.
Upper Stage
Works for me as well. Thanks! You're a champ.
Sneakyness
Good find - this is definitely it. A `<meta/>` for the content-type w/a charset wouldn't hurt, either.
Peter Bailey
+1 to Peter Bailey! That meta is `<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">`
artlung
A: 

Hi Sneakyness,

Your page doesn't validate, maybe that's it.

First of all, add a doctype to your HTML-code and some more content-encoding stuff:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8" />
    <meta http-equiv="content-style-type" content="text/css" />
    <link
    (...)
Harmen
no. Everything validated before I tore everything apart to figure out this bug.
Sneakyness
The validator says that you need to add character encoding, which seems to be the problem...
Harmen
regardless of what the contents of the file says it's encoded in, if I encode the file as something else, those have no effect.
Sneakyness
A doctype and a content-type is a good idea, even if it's not the solution to this exact problem. No xml tag before the doctype though, or IE will ignore the doctype. What to use for content-type is up for debate, but that doesn't matter that much, it's the charset part that is most useful.
Guffa