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

* 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?
>http://www.w3.org/International/questions/qa-htaccess-charset.html
>
>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

  http://cgi.w3.org/cgi-bin/headers

and

  http://www.w3.org/International/questions/qa-headers-charset.html

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
  </Files>
[...]

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>

Or

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

which should rather be

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

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