473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

http-equiv vs true header: which has precedence?

Hi,

If you have both this HTTP header:

Content-Type: text/html; charset=ISO-8859-1

and this HTML element in the <head>:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
Which one is supposed to take precedence (override the other)?

Thanks.

Jul 24 '05 #1
10 6308
Newry <Ne***@nospam.com> wrote:
If you have both this HTTP header:

Content-Type: text/html; charset=ISO-8859-1

and this HTML element in the <head>:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
Which one is supposed to take precedence (override the other)?


The HTTP header.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 24 '05 #2
On Wed, 6 Apr 2005, Newry wrote:
Content-Type: text/html; charset=ISO-8859-1

and this HTML element in the <head>:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

Which one is supposed to take precedence (override the other)?


Feel free to consult the authoritative RFC2616. Nothing that we say
here could possibly override that.

See also http://www.w3.org/TR/REC-html40/charset.html#h-5.2.2 - also
appendix C to the XHTML/1.0 specification if you're interested in
XHTML.

(For HTTP transfers, the true HTTP header has priority over all other
sources. But that would be true or false no matter what anyone were
to say here about it. So be sure to consult the authoritative
sources. And nowadays even the popular browsers have caught up with
that.)
Jul 24 '05 #3
Thanks Alan and Steve.
Jul 24 '05 #4
Newry wrote:
Hi,

If you have both this HTTP header:

Content-Type: text/html; charset=ISO-8859-1

and this HTML element in the <head>:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">


The question is, why would you even bother including a pseudo-header
using a meta element, when you can just use the real thing? Meta
elements used with http-equiv should generally be avoided all the time
when the pages are being served over HTTP. Their only use would be if
the file is being loaded from the local file system or other location
where HTTP headers are unavailable, or are not properly configurable.

You may also be interested in reading "When Specifications Collide",
which discusses this issue a little more.
http://ln.hixie.ch/?start=1037398795&count=1

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Jul 24 '05 #5
Lachlan Hunt wrote:
Newry wrote:
Hi,

If you have both this HTTP header:

Content-Type: text/html; charset=ISO-8859-1

and this HTML element in the <head>:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

The question is, why would you even bother including a pseudo-header
using a meta element, when you can just use the real thing? Meta
elements used with http-equiv should generally be avoided all the time
when the pages are being served over HTTP. Their only use would be if
the file is being loaded from the local file system or other location
where HTTP headers are unavailable, or are not properly configurable.

You may also be interested in reading "When Specifications Collide",
which discusses this issue a little more.
http://ln.hixie.ch/?start=1037398795&count=1


Exactly. Not every server has this or that module loaded and/or compiled
into it. E.g, my host will not enable mod_expires, hence I have a
http-equiv expires "workaround".

Furthermore, I send my page's language via a Content-Language header,
yet Bobby complains I'm not specifying a language and insists I put
<HTML lang="en"> etc, in my coding.

Sort of flies in the face of what Alan Flavell just wrote re: RFC 2616.
Jul 24 '05 #6
On Wed, 6 Apr 2005, Peter1968 wrote:
Lachlan Hunt wrote:

You may also be interested in reading "When Specifications Collide", which
discusses this issue a little more.
http://ln.hixie.ch/?start=1037398795&count=1

Exactly. Not every server has this or that module loaded and/or
compiled into it. E.g, my host will not enable mod_expires, hence I
have a http-equiv expires "workaround".


It would be good if people would stop trying to find excuses for
failing to follow best-practice. Already CERT security alert
CA-2000-02 was counselling *not* to send pages out without an explicit
HTTP charset specification. And if there is one, it /has/ to be
correct, since it overrides all other sources of information, and
there will be severe problems if the other sources are incompatible
with it.

Along the lines of what Mark Nottingham says: if your provider does
not offer the features which you need for doing the job properly,
*complain loudly*.
Furthermore, I send my page's language via a Content-Language
header, yet Bobby complains I'm not specifying a language and
insists I put <HTML lang="en"> etc, in my coding.
Bobby is only (trying to) apply the WAI rules as published. So
that report stands or falls by what the WAI actually calls for.
Sort of flies in the face of what Alan Flavell just wrote re: RFC
2616.


I'm not sure which detail you're referring to here. The charset issue
is clear enough: a particular document instance is in one and only one
character encoding[1] - the HTTP and meta (and ?xml encoding) are all
ways of specifying that encoding.

But there are subtle differences between HTTP language attribute, and
HTML language attributes. They aren't necessarily identical (though
the examples might appear somewhat contorted). For example, a Latin
primer aimed at an English-speaking audience contains both English and
Latin content, but would be negotiated in HTTP as an English-language
document. It would be of little interest to someone who was genuinely
seeking a Latin *document*.

best regards

[1] modulo the detail that you can refer to ASCII as iso-8859-anything
or as utf-8 if it suits you to do so, since they're indistinguishable
at that level.
Jul 24 '05 #7
In article <r1********************************@4ax.com>,
Steve Pugh <st***@pugh.net> wrote:
Which one is supposed to take precedence (override the other)?


The HTTP header.


Right. However, at least earlier Safari did it the other way round. I
have not tested whether that bug has been fixed.

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 24 '05 #8
Alan J. Flavell wrote:
On Wed, 6 Apr 2005, Peter1968 wrote:

Furthermore, I send my page's language via a Content-Language
header, yet Bobby complains I'm not specifying a language and
insists I put <HTML lang="en"> etc, in my coding.

Bobby is only (trying to) apply the WAI rules as published. So
that report stands or falls by what the WAI actually calls for.


http://www.w3.org/TR/WCAG10/#gl-abbreviated-and-foreign
Checkpoint 4.3 of that also calls for servers to set content language.
I've asked quite a few people and the consensus I've gotten back is
that's what the W3C is trying to say here.

I've been at Watchfire for nearly a year to get them to update things.
Still, it has real bearing on this thread, I guess, and I'll butt out
about here.
Jul 24 '05 #9
On Wed, 6 Apr 2005, Peter1968 wrote:
http://www.w3.org/TR/WCAG10/#gl-abbreviated-and-foreign
Checkpoint 4.3 of that also calls for servers to set content language.


No. Read again.

--
Mars, unlike Earth, has no atmosphere.
The Chicago manual of style, 15th ed., p. 362

Jul 24 '05 #10
On Wed, 6 Apr 2005, Peter1968 wrote:
Bobby is only (trying to) apply the WAI rules as published. So
that report stands or falls by what the WAI actually calls for.
http://www.w3.org/TR/WCAG10/#gl-abbreviated-and-foreign


The preamble to that, curiously, calls for one -or- the other:

Content developers should identify the predominant natural language
of a document's content (through markup or HTTP headers).
^^^^
Checkpoint 4.3 of that also calls for servers to set content language.


Curiously, neither 4.1 nor 4.3 say anything definite about emitting
content-language HTTP headers as such. What 4.3 is calling for is
that servers are configured to support content negotiation mechanisms:
that's a separate issue (which might lead the server to send a "Vary:"
header, but won't directly cause a Content-language header to be sent,
AFAIR).

I think Bobby is technically correct to report a violation of
checkpoint 4.3 itself if the HTML element does not have a "lang"
attribute (even though the wording of the preamble suggested that the
HTTP header would be an acceptable alternative, checkpoint 4.3 doesn't
actually allow it). Whether 4.3 is well formulated is a separate
discussion point, of course. However, this is only at priority 3.

If there is more than one language in the document, then a failure to
mark them up with HTML attributes wherever they occur would be a
violation of checkpoint 4.1, which is priority 1, on the other hand.

--
Jul 24 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wolfgang May | last post by:
Hi, I have a problem with the HTTP implementation of the PEAR package: I try to PUT an XML instance to an XML database (eXist), but it always puts a binary: <?php require_once...
8
by: ben | last post by:
I'm trying to write a web client script in python to log onto a web page and pull some information off of it. The page has quite a few behind the scenes http things going on that are making it...
24
by: sinister | last post by:
After doing a websearch, it appears that it's OK to omit the "http:" to form a relative URL. Are there any pitfalls to this? For example, if there is a page http://www.domain1.com/page1.html...
3
by: mike | last post by:
regards: How do I know that edition 1.0 or 1.1 the HTTP Server support?..... Support of HTTP edition is decided by client end or server end? Any positive suggestion is welcome. thank you May...
1
by: Paul Fi | last post by:
im making a tcp server and tcp client to exchange Http messages is it possible? if so how from what i know that Http is an app protocol and sits above TCP so how can i take advantage of that in...
6
by: Guest | last post by:
Hi, I unerstand that if you choose IIS to host your .Net Remotingcomponents with HTTP channel and SOAP formatter, you get thebuilt-in security and configuraion features of IIS. Also we canexpose it...
2
by: sushi | last post by:
Hello, I want to send a HTTP post request. The url will be given in the format http://host:port/remainder-of-URL where host is the DNS name or IP address of the host where the receiver is...
3
by: Rudy Ko | last post by:
Hi, all, Anyone know how to issue a http request from VC or have a sample? Thanks!! Regards, Rudy
0
by: WIWA | last post by:
Hi, I want to login to a password protected website and fetch the content of the page behind. I have based my code on http://weblogs.asp.net/jdennany/archive/2005/04/23/403971.aspx. When I use...
5
by: David Lozzi | last post by:
Howdy, I wrote a web service in .Net for my customer. My customer has another vendor who now has to consume it but they are not using Visual Studio. Most of their pages are jsp, and they said...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.