W3C home > Mailing lists > Public > www-international@w3.org > April to June 2004

Re: New FAQ for review: Setting charset information in .htaccess

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Thu, 17 Jun 2004 23:18:22 +0200
To: "Richard Ishida" <ishida@w3.org>
Cc: <www-international@w3.org>
Message-ID: <40d3053b.283794354@smtp.bjoern.hoehrmann.de>

* Richard Ishida wrote:
>Here is a first draft of a new FAQ, answering the question:
>> How do I use .htaccess directives on an Apache server to serve files with a specific encoding?
>Please send comments to help me produce a final draft.  Thanks.

There are two things readers should be aware of before going into the
details of the answer, whether they want to do this at all and if they
want to do it, which encoding should be specified. The former is pointed
out after the answer, so you read the entire answer just to read
something else that tells you do not do that which is rather
unfortunate. Is there a document that explains how to figure out what
the encoding of existing documents might be? If so, it should along with
the document that explains whether this should be done at all be linked
from the top, suggested prior reading, or something.

There should be means to interactively figure out what the server
currently declares, e.g. by including the form from




should be linked directly from the "Background" section.

It seems you confuse <Files ...> and <Files ~ ...>, the latter expects
a regular expression and is thus equivalent to FilesMatch, which is

  In Apache 1.3 and later, <FilesMatch> is preferred, however.

The example

  <Files ~ "example\.html">
  AddCharset UTF-8 .html

Would match all file names that contain the substring "example.html",
e.g. "myexample.html" or "my-example.html.old.xhtml.utf16", it seems
you rather want to use

  <Files "example.html">
  AddCharset UTF-8 .html


  <Files ~ "^example\.html$">
  AddCharset UTF-8 .html

which should rather be

  <FilesMatch "^example\.html$">
  AddCharset UTF-8 .html

The first occurence of the various directives should be links to the
Apache server manual. It would also be good to stress to which server
software packages this applies (Apache is not the only .htaccess aware
server), how to figure out which server software is used for the users
web site (HTTP header, Netcraft, ...) and that .htaccess is an optional
feature, it requires that the server administrator or the web hosting
provider allows AllowOverride +FileInfo which is not available to every-
one and whether it is named ".htaccess" depends on the AccessFileName
setting, which is also sometimes changed for "security" reasons. 

Directing readers to check their manuals or contacting the hosting
provider in case of further questions or if anything fails might be a
good idea.
Received on Thursday, 17 June 2004 17:19:02 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 21 September 2016 22:37:24 UTC