http-equiv vs true header: which has precedence?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Newry

    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=ut f-8">


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

    Thanks.



  • Steve Pugh

    #2
    Re: http-equiv vs true header: which has precedence?

    Newry <Newry@nospam.c om> wrote:
    [color=blue]
    >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=ut f-8">
    >
    >
    >Which one is supposed to take precedence (override the other)?[/color]

    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 <steve@pugh.net > <http://steve.pugh.net/>

    Comment

    • Alan J. Flavell

      #3
      Re: http-equiv vs true header: which has precedence?

      On Wed, 6 Apr 2005, Newry wrote:
      [color=blue]
      > Content-Type: text/html; charset=ISO-8859-1
      >
      > and this HTML element in the <head>:
      >
      > <meta http-equiv="Content-Type" content="text/html;charset=ut f-8">
      >
      > Which one is supposed to take precedence (override the other)?[/color]

      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.)

      Comment

      • Newry

        #4
        Re: http-equiv vs true header: which has precedence?

        Thanks Alan and Steve.

        Comment

        • Lachlan Hunt

          #5
          Re: http-equiv vs true header: which has precedence?

          Newry wrote:[color=blue]
          > 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=ut f-8">[/color]

          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.


          --
          Lachlan Hunt

          http://GetFirefox.com/ Rediscover the Web
          http://GetThunderbird.com/ Reclaim your Inbox

          Comment

          • Peter1968

            #6
            Re: http-equiv vs true header: which has precedence?

            Lachlan Hunt wrote:[color=blue]
            > Newry wrote:
            >[color=green]
            >> 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=ut f-8">[/color]
            >
            >
            > 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
            >[/color]

            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.

            Comment

            • Alan J. Flavell

              #7
              Re: http-equiv vs true header: which has precedence?

              On Wed, 6 Apr 2005, Peter1968 wrote:
              [color=blue]
              > Lachlan Hunt wrote:[color=green]
              > >
              > > 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
              > >[/color]
              >
              > 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 ".[/color]

              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*.
              [color=blue]
              > 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.[/color]

              Bobby is only (trying to) apply the WAI rules as published. So
              that report stands or falls by what the WAI actually calls for.
              [color=blue]
              > Sort of flies in the face of what Alan Flavell just wrote re: RFC
              > 2616.[/color]

              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 indistinguishab le
              at that level.

              Comment

              • Henri Sivonen

                #8
                Re: http-equiv vs true header: which has precedence?

                In article <r17651lk0l4pkg ojoljtfchiqpdok 54ec2@4ax.com>,
                Steve Pugh <steve@pugh.net > wrote:
                [color=blue][color=green]
                > >Which one is supposed to take precedence (override the other)?[/color]
                >
                > The HTTP header.[/color]

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

                --
                Henri Sivonen
                hsivonen@iki.fi

                Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html

                Comment

                • Peter1968

                  #9
                  Re: http-equiv vs true header: which has precedence?

                  Alan J. Flavell wrote:[color=blue]
                  > On Wed, 6 Apr 2005, Peter1968 wrote:[/color]
                  [color=blue][color=green]
                  >>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.[/color]
                  >
                  >
                  > Bobby is only (trying to) apply the WAI rules as published. So
                  > that report stands or falls by what the WAI actually calls for.
                  >[/color]


                  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.

                  Comment

                  • Andreas Prilop

                    #10
                    Re: http-equiv vs true header: which has precedence?

                    On Wed, 6 Apr 2005, Peter1968 wrote:
                    [color=blue]
                    > http://www.w3.org/TR/WCAG10/#gl-abbreviated-and-foreign
                    > Checkpoint 4.3 of that also calls for servers to set content language.[/color]

                    No. Read again.

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

                    Comment

                    • Alan J. Flavell

                      #11
                      Re: http-equiv vs true header: which has precedence?

                      On Wed, 6 Apr 2005, Peter1968 wrote:
                      [color=blue][color=green]
                      > > Bobby is only (trying to) apply the WAI rules as published. So
                      > > that report stands or falls by what the WAI actually calls for.[/color]
                      >
                      > http://www.w3.org/TR/WCAG10/#gl-abbreviated-and-foreign[/color]

                      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).
                      ^^^^
                      [color=blue]
                      > Checkpoint 4.3 of that also calls for servers to set content language.[/color]

                      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.

                      --

                      Comment

                      Working...