Closed Bug 114209 Opened 23 years ago Closed 23 years ago

0.9.6 doesn't interpret style sheets from <link rel>-tag

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Linux
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 107790

People

(Reporter: adv, Assigned: dbaron)

Details

Attachments

(3 files)

This problem was introduced with Mozilla 0.9.6, it wasn't there in the previous
versions.

<?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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test with CSS 2</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<p class="navbar"><span class="navbarinfo">Home</span></p>
</body>
</html>

The file style.css looks like this:
body { background-color:#ffffff; font-family:Helvetica,Arial,sans-serif;
color:#000000; font-size:12px; }
.navbar { background-color:#ededed; font-size:10px; color:#000000; }            
.navbaritem { background-color:#e0e0e0; color:#0d0d0d; font-weight:bold; }

when opening the page, the browser loads the style-sheet (I see this in my
access-log from apache) but does not interpret it, just default colors black and
white are used, instead of the background-colors und fonts defined in the
stylesheet. However this worked fine with the older Mozilla versions.

I tried to switch to Transitional instead of Strict, and left out the
XML-things, but it didn't change anything. However, if I use inline-CSS
everything works.

Many sites which looked ok with 0.9.5, doesn't look good any longer, because the
style-sheet is not used.
Attached file HTML testcase
This is working fine for me with the attached testcase (which is just the HTML
and CSS originally pasted into the bug).

Is there a site "in the wild" where this happening?  Does the stylesheet contain
_anything_ (especially comments) other than the text you pasted in this bug?
Well, I tracked down the problem. Seems the problem is not the <link rel>-tag,
but the style-sheet itself. Since I use the same style-sheet with more or less
extensions the problem occured on every page.

If a comment line contains an umlaut (eg "ü") the style-sheet is not
interpreted (although it worked with 0.9.5 and earlier).

The attached style-sheet reproduces the problem. If you cut the line

 * 2001/11/17 - Matthias Hensler: Hovers für Selects und Submits

or just the "ü" in "für" it works well.

Should be trivial to fix this.
Summary: 0.9.6 doesn't intrepret style sheets from <link rel>-tag → 0.9.6 doesn't interpret style sheets from <link rel>-tag
Yep.  That xhtml page is encoded as UTF-8.  The stylesheet contains a character
that is not a valid UTF-8 character, so decoding the sheet fails.  Yes, the
behavior of using the character coding of the document to decode the sheet is
new since 0.9.5 (before we defaulted to ISO-8859-1 instead of the document
encoding, and the character in question _is_ valid in ISO-8859-1).

This bug _is_ going to be "fixed" (we're going to start ignoring decoding errors
eventually) but in some cases you may actually get incorrect results if your
sheet is decoded using the wrong encoding.

What you should do to make sure this is never a problem is put:

@charset "ISO-8851-1";

as the first thing in your stylesheet, before any comments, rules, or
whitespace.  That will make sure the sheet is always decoded as ISO-8859-1 by
any browser which claims to support CSS.

see bug 106843 for details.

*** This bug has been marked as a duplicate of 107790 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
> @charset "ISO-8851-1";

I meant 

@charset "ISO-8859-1";


Thanks alot for tracking this down. When I specify the encoding in the
style-sheet everything works fine. I just wonder why the translation does not
fail if I include the style-sheet inline?

Anyway, thanks for your help and work. Sorry to bother with this problem which
was actually my fault.
Inline sheets are decoded together with the whole document by the HTML parser. 
This has a workaround built in to deal with this issue, since it apparently pops
up a lot in HTML pages.

external sheets are decoded in the CSS loader....  The bug I marked this a
duplicate of is the bug on being able to skip decoding errors without writing
cludgey workarounds.  Once that's fixed, the CSS loader can use that, as can the
HTML parser.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: