Bug 106554 - wrong encoding of CSS style stored in separate file (not conforming to CSS/2.1)
Summary: wrong encoding of CSS style stored in separate file (not conforming to CSS/2.1)
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal with 20 votes (vote)
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 107287 109735 114143 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-05-31 14:13 UTC by Jan Kundrát
Modified: 2006-06-03 20:59 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kundrát 2005-05-31 14:13:41 UTC
Version:           3.4.0 (using KDE KDE 3.4.0)
Installed from:    Gentoo Packages
Compiler:          gcc (GCC) 3.3.5-20050130 (Gentoo Linux 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1) 
OS:                Linux

Konqueror/3.4.0 doesn't conform to CSS/2.1 standard as defined in http://www.w3.org/TR/CSS21/syndata.html#q23 - section about encoding (character set) of external CSS style. Suppose we have HTML page written in UTF-8 (server sends "Content-Type: text/html; charset=utf-8") which referrs to CSS in external file on the same server. It's clearly illustrated in http://dev.gentoo.org/~neysx/wwwgo/index.xml.html which referrs to http://dev.gentoo.org/~neysx/wwwgo/css/main.css . Later is also in UTF-8, but the server doesn't specify the "charset" part of Content-Type header. According to the CSS/2.1 specs, correct behaviour would be to:

1) An HTTP "charset" parameter in a "Content-Type" field (or similar parameters in other protocols) - not usable in this case

2) BOM and/or @charset (see below) - also doesn't apply

3) <link charset=""> or other metadata from the linking mechanism (if any)
charset of referring stylesheet or document (if any) - this should be used, but isn't - se below

4) Assume UTF-8 - fallback, but should *not* happen as it would break a lot of pages, IMHO


So, to the point 3 - you should use the same encoding as the HTML page has, which is UTF-8, in this case. But current behavior is that if you have set (in browser prefs) anything else as a "default codepage", it is used, which is bad.

Why is this important? In that particular case, external CSS sheet is used to add "content:" property to the links in the left hand column, which should result in a nice arrow before each link. But because konqueror uses other encoding for CSS file parsing, user doesn't see arrow, but some garbage characters. I can provide screenshot.
Comment 1 Xavier Neys 2005-05-31 16:14:12 UTC
Using @charset at the beginning of the css had no effect on konqueror

Escaping the character worked but the small triangle appears as a thin box as if the character was not defined. I tried various fonts with the same result. Using a dot instead of a triangle worked.

a.altlink:before {content:"\2022\20"; color:#7a5ada;}  OK
a.altlink:before {content:"\2023\20"; color:#7a5ada;}  Not OK

Escaped char or utf-8 encoded css works with firefox
a.altlink:before {content:"‣ "; color:#7a5ada;}  OK in ff
Comment 2 Eckhart Wörner 2005-06-12 20:04:52 UTC
*** Bug 107287 has been marked as a duplicate of this bug. ***
Comment 3 Maksim Orlovich 2005-07-28 00:43:58 UTC
*** Bug 109735 has been marked as a duplicate of this bug. ***
Comment 4 Maksim Orlovich 2005-10-09 21:51:23 UTC
*** Bug 114143 has been marked as a duplicate of this bug. ***
Comment 5 Allan Sandfeld 2006-06-03 20:59:39 UTC
SVN commit 547892 by carewolf:

Let stylesheets inherit the charset of their parent document or stylesheet.
Introduces a charset property for all stylesheets.
BUG: 106554


 M  +3 -3      css/css_ruleimpl.cpp  
 M  +1 -1      css/css_ruleimpl.h  
 M  +4 -0      css/css_stylesheetimpl.h  
 M  +5 -1      html/html_headimpl.cpp  
 M  +1 -1      html/html_headimpl.h  
 M  +35 -12    misc/loader.cpp  
 M  +5 -4      misc/loader.h  
 M  +1 -1      misc/loader_client.h  
 M  +1 -1      xml/dom_docimpl.cpp  
 M  +1 -1      xml/dom_docimpl.h  
 M  +2 -1      xml/dom_xmlimpl.cpp  
 M  +1 -1      xml/dom_xmlimpl.h