Bug 18692 - Incorrect charset declaration is not honored
Summary: Incorrect charset declaration is not honored
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL: http://s.kuaiche.com/s/search?sid=168...
Keywords:
: 25107 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-22 23:20 PDT by xijia
Modified: 2009-04-10 01:28 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xijia 2008-04-22 23:20:59 PDT
[Steps]
1 Launch Safari 3.1.1
2 Navigate to http://s.kuaiche.com/s/search?sid=1684&q=SnagIt%20V8.3.2%20Build%20014%20%E7%A0%B4%E8%A7%A3&stime=0.45721800%201208919835&srefer=http%3A%2F%2Fwww.tiansha.net%2Fdown%2Fsoft%2F708.htm&surl=a1804d9e8ffda43e721ecfa672f2a35c&r=99&s=0&t=0&f=0&p=0
3 Click the first download link in this page (The green down arrow)
4 Observe

[Result]
1 The popped up page displayed as garbage
2 Right click on this page, the context menu doesn't show up

[Expected]
1 The page should be decoded correctly and no garbage
2 The context menu should pop up

[Notes]
View source of the popped up page from FF, you can see actually this page has meta charset declared
Comment 1 xijia 2008-04-23 04:40:36 PDT
(In reply to comment #0)
> [Steps]
> 1 Launch Safari 3.1.1
> 2 Navigate to
> http://s.kuaiche.com/s/search?sid=1684&q=SnagIt%20V8.3.2%20Build%20014%20%E7%A0%B4%E8%A7%A3&stime=0.45721800%201208919835&srefer=http%3A%2F%2Fwww.tiansha.net%2Fdown%2Fsoft%2F708.htm&surl=a1804d9e8ffda43e721ecfa672f2a35c&r=99&s=0&t=0&f=0&p=0
> 3 Click the first download link in this page (The green down arrow)
> 4 Observe
> 
> [Result]
> 1 The popped up page displayed as garbage
> 2 Right click on this page, the context menu doesn't show up
> 
> [Expected]
> 1 The page should be decoded correctly and no garbage
> 2 The context menu should pop up
> 
> [Notes]
> View source of the popped up page from FF, you can see actually this page has
> meta charset declared
> 

If you look the meta charset declaration, it is <meta http-equiv="Content-Type" content="text/html; charset="gb2312" />, you will find there is a extra double quotation mark before the literal gb2312.
So the method TextResourceDecoder::checkForHeadCharset (WebKit code) will treat the attribute declaration part of the meta tag as more than three parts because it ignore ">", opening tag ends symbol,  which is quoted.
part1 : http-equiv="Content-Type"
part2: content="text/html; charset="
part3: gb2312" />.......
So you see TextResourceDecoder::checkForHeadCharset can not find the end of meta tag, so it is failed to detect charset.
Comment 2 xijia 2008-04-23 04:42:15 PDT
The context menu could not be popped up because the author of this web page disabled it.   See the following script snippet from the page
document.oncontextmenu=function(event){event.returnValue=false;};

So it works as intended for second problem, however, when right click on IE and FF, the context menu can pop up
Comment 3 mitz 2008-04-23 08:37:35 PDT
I think the context menu behavior is correct, but the incorrect decoding of the text might be a bug.
Comment 4 Alexey Proskuryakov 2008-04-28 11:17:16 PDT
See also: bug 17740.
Comment 5 Alexey Proskuryakov 2009-04-10 01:28:22 PDT
*** Bug 25107 has been marked as a duplicate of this bug. ***