Closed Bug 293148 Opened 20 years ago Closed 20 years ago

Firefox believe more to Response Headers charset not to page charset specified

Categories

(Toolkit :: View Source, defect)

1.7 Branch
x86
Windows XP
defect
Not set
major

Tracking

()

VERIFIED DUPLICATE of bug 238488

People

(Reporter: gmarketer, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.7) Gecko/20050414 Firefox/1.0.3

For Example:
Server which servers the page http://marketolog.boom.ru/articles/default.htm
adds response header
Content-Type: text/html; charset=windows-1251
but page contains declaration that it written in utf-8, and Firefox believe more
to server, not to page author.

Reproducible: Always

Steps to Reproduce:
1.read details
2.goto http://marketolog.boom.ru/articles/default.htm
3. see result

Actual Results:  
garbage in output

Expected Results:  
russian page about marketing
Version: unspecified → 1.0 Branch
Do you have a standard that says that an 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
element takes precedence over the http header?

If not, then Firefox is probably doing the right thing.
Sorry, but Content-Type has higher priority. See
http://www.w3.org/TR/html401/charset.html#h-5.2.2 which says

To sum up, conforming user agents must observe the following priorities when
determining a document's character encoding (from highest priority to lowest):

   1. An HTTP "charset" parameter in a "Content-Type" field.
   2. A META declaration with "http-equiv" set to "Content-Type" and a value set
for "charset".
   3. The charset attribute set on an element that designates an external resource.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
The logic:
   1. An HTTP "charset" parameter in a "Content-Type" field describes charset of
stream passed to client browser.
   2. A META declaration with "http-equiv" set to "Content-Type" and a value set
for "charset" describe page charset.
   3. The charset attribute set on an element that designates an external
resource  describes more precise charset of element.

This logic is used by webmasters all over the world and should be realized in
Firefox for compatibility.

IE shows such pages in right charset, Firefox not. It's confusing end users.

There are many websites which using such logic. Every such website is displayed
as garbage.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
dupe of bug 238488 -> invalid

Don't send a charset in the header if you want to specify the charset in the html 

*** This bug has been marked as a duplicate of 238488 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
(In reply to comment #3)
>
> ...
> 
> There are many websites which [impute priority to the META tag]. Every 
> such website is displayed as garbage.

There is a big gap between you statement and reality. Now the URL given in 
comment 2 is densely written, but it does say:

	User agents may provide a mechanism that allows users to
	override incorrect "charset" information. However, if a user
	agent offers such a mechanism, it should only offer it for
	browsing and not for editing, to avoid the creation of Web
	pages marked with an incorrect "charset" parameter.

Firefox provides such a mechanism in the View->Character Encoding menu,
and the user need not see garbage.

Just above that paragraph is another that you may find helpful.

Further info offfered:

I appreciate the people who write web pages are a very disparate group, and
probably have nothing in common with each other save that they write web pages
and most do not control their server or web site. It is pointless expecting
web page authors to know or care how web servers are configured. However,
it is possible to configure web servers correctly, and this is necessary
to use HTTP 1.1 in the first place. In the case of character encoding 
(sometimes called charset) this has the tremendous advantage that the 
meta-information is passed out of band, and is known before the user agent
meets, say, the opening '<' of an XML declaration. 

With respect, it is necessary that Firefox obeys these standards.

There has been considerable debate about this, and I do assure you that the
logic behind your point (2) that the web page author ought to have a say in the
character encoding meta-information has been carefully scrutinised. In the first
place, if a META tag is used by the user agent it can only take effect after 
that tag has been read, and therefore part of the page will always have some 
default encoding (and I suspect that this would be highly error-prone as well), 
and in the second place the proper way of doing this is to have web servers 
determine the character encoding. This implies that every web server be 
configured to do it correctly, which you seem to think is impossible; and very 
definitely means that a standards compliant user agent (such as Firefox) must 
treat the http header as definitive, which is what this bug is all about!
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.