Closed
Bug 312179
Opened 19 years ago
Closed 19 years ago
CSS stylesheet doesn't work if it's encoding is ASCII but the web page is in Unicode
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: o3, Assigned: dbaron)
References
Details
Attachments
(1 file)
2.09 KB,
application/zip
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7
In case, when encoding of stylesheet (CSS file) is ASCII,
but web page (HTML) is in Unicode, importing of stylesheet
using "LINK" tag, like this:
<LINK HREF="Style (ASCII).css" REL="stylesheet" type="text/css">
All other combinations of encoding (ASCII/Unicode) of stylesheet
and web page works fine.
Reproducible: Always
Steps to Reproduce:
1. Prepare a web page "HTML (Unicode), Style (ASCII).html"
<html>
<head>
<title>Ruksis</title>
<LINK HREF="Style (ASCII).css" REL="stylesheet" type="text/css">
</head>
<body>
<h1>HTML: Unicode, Style: ASCII</h1>
<p>lielais ruksis</p>
<pre>ruk ruk ruk</pre>
</body>
</html>
and save it in Unicode (this is IMPORTANT) encoding!
2. Prepare a CSS StyleSheet "Style (ASCII).css":
BODY {background: Red; font-size: 30pt}
P {color: White}
PRE {font-weight: Bold; color: Yellow}
H1 {font-size: 36pt}
and save it in ASCII (this is IMPORTANT) encoding!
3. Open the web page "HTML (Unicode), Style (ASCII).html" and check if
stylesheet is applied.
Actual Results:
Page looks black and white and one can see, that stylesheet has not been applied.
Expected Results:
Stylesheet must be applied and background should be red and black, white and
yellow text should be visible.
Using these files you can test if the stylesheet is applied correctly.
Comment 2•19 years ago
|
||
I can confirm the behaviour...
Comment 3•19 years ago
|
||
What encoding is specified in the HTTP headers being served with the CSS page?
Assignee: nobody → dbaron
Component: General → Style System (CSS)
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
Comment 4•19 years ago
|
||
This is invalid; see the section on stylesheet encodings in CSS2.1. Since you
don't send an HTTP header, don't use a charset="" in the link, and don't have an
@charset in the sheet, we use the page encoding for the sheet.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Comment 5•19 years ago
|
||
*** Bug 315441 has been marked as a duplicate of this bug. ***
Comment 7•18 years ago
|
||
According to RFC 2616, section 371, a document sent by HTTP without charset is assumed to be ISO-8859-1 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1).
The CSS 2.1 specification, http://www.w3.org/TR/CSS21/syndata.html#q23, appears to be contradictory, but I don't believe it is. The line basically says that if the transfer protocol specifies an encoding, it should be used. HTTP does specify the encoding implicitely in this case.
Comment 9•18 years ago
|
||
Sorry, but the CSS specification is written precisely to specify the behavior we're following. The HTTP section you quote really doesn't make much sense in today's "there's more to the world than Western Europe" situation, and pretty much no one follows it for anything, since doing so would break the web.
Comment 10•18 years ago
|
||
This is nonsense, RFC 2616 is in full force and any browser I know of obeys it (and has to obey it), including, for normal cases, Firefox. For example, I have uploaded a test file:
http://www.freepascal.org/~daniel/text.txt
It shows the text "åߢðë" on multiple lines and is served without charset. You won't find a browser that does not assume it to be ISO-8859-1.
While I agree that, were the standard designed today, a different default would make more sense, ISO-8859-1 is still a workable default. Note that up to HTML 3.2, no other character set than ISO-8859-1 was allowed, and for backwards compatibility documents need to be interpreted as such if no character set is specified.
Wether Firefox is behaving correctly according to the CSS specification is up to interpretation, but it should get the benefit of the doubt. In any case different browsers are behaving different here.
Comment 11•18 years ago
|
||
> You won't find a browser that does not assume it to be ISO-8859-1.
Firefox, if the user sets a different default charset in the preferences. Which any Japanese user would, say.
And yes, different browsers behave differently here. Which is why you should always send encodings (or <meta> tags, or @charset rules, etc) instead of relying on error-recovery behavior.
Comment 12•18 years ago
|
||
Adding charset specifications is a good practise, I think nobody will disagree with that :)
You need to log in
before you can comment on or make changes to this bug.
Description
•