Summary: | External CSS style-sheets default to wrong charset | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Thiago Macieira <thiago> |
Component: | khtml parsing | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | illogical1 |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Test page, HTML 4.01 Transitional, UTF-8
Test CSS stylesheet, UTF-8 encoded Attempt at fixing the problem Second attempt at fixing |
Description
Thiago Macieira
2004-04-04 21:20:45 UTC
Created attachment 5531 [details]
Test page, HTML 4.01 Transitional, UTF-8
Created attachment 5532 [details]
Test CSS stylesheet, UTF-8 encoded
The functions at fault are: CachedObject::codecForBuffer (khtml/misc/loader.cpp) DocLoader::requestStyleSheet (same) Nowhere in misc/loader.cpp does it try and get the charset from the KIO metadata. Created attachment 5535 [details]
Attempt at fixing the problem
The attached patch fixes the problem for me, both for remote files and local
ones. It does:
- move the m_charset member from khtml::CachedCSSStyleSheet and
khtml::CachedScript into khtml::CachedObject. It won't be used, of course, for
images (khtml::CachedImage).
- in khtml::Loader::slotFinished, query the metadata from the job before
calling r->object->data. In case of local files, use the charset from
QTextCodec::codecForLocale
Created attachment 5632 [details]
Second attempt at fixing
The previous patch made the server charset parameter override the user's. This
one inverts that logic.
*** Bug 100993 has been marked as a duplicate of this bug. *** CVS commit by carewolf: Make charset in <link> actually mean something. Patch is simplified version of one by Thiago Maciera BUG: 79065 M +4 -0 ChangeLog 1.408 M +2 -2 misc/loader.cpp 1.181 --- kdelibs/khtml/ChangeLog #1.407:1.408 @@ -1,2 +1,6 @@ +2005-03-22 Allan Sandfeld Jensen <kde@carewolf.com> + + * misc/loader.cpp: Do not override existing charset with an empty one. + 2005-03-21 Allan Sandfeld Jensen <kde@carewolf.com> --- kdelibs/khtml/misc/loader.cpp #1.180:1.181 @@ -968,5 +968,5 @@ CachedCSSStyleSheet *DocLoader::requestS CachedCSSStyleSheet* s = Cache::requestObject<CachedCSSStyleSheet, CachedObject::CSSStyleSheet>( this, fullURL, accept ); - if ( s ) { + if ( s && !charset.isEmpty() ) { s->setCharset( charset ); } @@ -981,5 +981,5 @@ CachedScript *DocLoader::requestScript( CachedScript* s = Cache::requestObject<CachedScript, CachedObject::Script>( this, fullURL, 0 ); - if ( s ) + if ( s && !charset.isEmpty() ) s->setCharset( charset ); return s; |