views:

42

answers:

2

I'm having a bizarre situation here where my external site files, both JavaScript and CSS, are being interpretted as somehow corrupt on Safari browsers. The same site looks fine in Internet Explorer, but on Safari the javascript and css are being completely ignored. If I look at the files through the Inspector, I can see that Safari views these files as containing junk characters -- either asian symbols or square boxes. When I navigate directly to the files, however, they appear just fine. See the site below, viewed in Safari 5, for an example:

http://amsoell.com/dch/castlemoore

If I embed the same exact CSS or JavaScript into the HTML itself, it renders perfectly. I don't know if this is a server issue or something in my CSS, but I'm at my wits end here.

+1  A: 

When loading in Chrome, the Developer Tools - Resources view shows me that style.css is entirely comprised of chinese or japanese characters. I suspect that this is the source of your problem.

I also get illegal character errors for the following files:

It appears that these files are entirely comprised of japanese or chinese characters - which I guess aren't valid in JS.

Dexter
Right, that's the problem. If you navigate to the files themselves, you'll see that they are *not* comprised of chinese or japanese characters, but something is telling the browser that they are when the're loaded via the HTML file. Take a look at http://amsoell.com/dch/castlemoore/css/style.css
andy
Yep - the files looked fine when I try to request them directly, but not when `link`ed in the page header. But - the page looks fine when I load it now, so I suspect that adding the extra meta page header got the server to send the scripts with the right encoding, or you've subsequently changed something else?
Dexter
No, after trying the meta tag, it didn't work. Then I individually opened each file and "converted" them to utf-8 and saved them back... this seemed to fix the problem, but now it's magically broken again.
andy
+2  A: 

I checked your website for validation and it's not valid. But the most interesting thing is that your enconding is utf-16le. You should put your encoding to utf-8. Just put the following line in your <head> section:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
Bogdan Constantinescu
The HTML may not pass validation, but that's not the problem here. I tried adding your meta tag, and that didn't fix the problem.
andy
I see it's working now
Bogdan Constantinescu