[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#397886: apache2.2-common: non wanted behaviour during upgrade: charset MUST not be created without user consent



On Fri, Nov 10, 2006 at 10:36:10AM +0100, Michel Briand wrote:
> mozilla selects utf8 if apache told him that its the default - even if the
> page designer used the content="text/html; charset=ISO-8859-15" in headers

Well.

AddDefaultCharset simply sets the default character set when the page does
not specify one; that is, Apache by default sends something like

  Content-type: text/html; charset=utf-8

instead of

  Content-type: text/html

Of course, any page is free to send a different content type, in which case
the default won't matter (Apache never sends it). For instance, in Perl:

  print $cgi->header(-type=>'text/html; charset=iso-8859-15');

or in PHP:

  header('Content-type: text/html; charset=iso-8859-15');

There are also ways of setting this explicitly for static pages (via
.htaccess and/or .meta files); see the Apache documentation for more
details.

Now, what you are probably thinking of is the following abomination:

  <head>
    <meta http-equiv="Content-type" content="text/html; charset=iso-8859-15">
  </head>

It is true that a Content-type: header with a character set will override
this. However, using http-equiv is strongly discouraged in general, and has
been so for years -- after all, what character set would the browser assume
for the <meta> tag? (And if you were serving non-HTML content, like plain
text, how would you specify the character set information if not in the HTTP
headers?) I have nothing to do with Apache maintenance, but you should at
least be aware that if this is indeed what you're doing, you shouldn't be
surprised when it breaks...

/* Steinar */
-- 
Homepage: http://www.sesse.net/



Reply to: