Forum Moderators: phranque

Message Too Old, No Replies

How to set the charset for autoindex?

apache autoindex charset setting utf-8 iso-8859

         

White Gandalf

12:25 am on May 28, 2006 (gmt 0)

10+ Year Member



Hallo,

my apache (2.0.55) always answers with "utf-8" encoded directory listings for autoindexed directories (defined in the http header).
The directory content, however, is "iso-8859-1" encoded by the OS, and is transfered to the client without any translation by the server, regardless of the difference between the coding of the underlying OS and the "wishes" of the server.

I tried to use headers with meta tags, but the Browsers obviously do not consider meta tags in the generated html content to be more specific than the definition by the server in the http header. Both IE and Mozilla derivates do this the same way. Unfortunately, IE cuts off anything from filenames after the first german umlaut it encounters, so that the listing partially becomes unreadable.

Something like AddDefaultCharset in the apache congig file doesn't change anything.

Is there any way to change the behaviour of apache?

Thanks for your interests.

encyclo

2:19 am on May 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



AddDefaultCharset
should make a difference - bear in mind that if you do not define a default charset, then ISO-8859-1 is used by default for HTML documents such as the generated directory listings.

What OS/version are you using? There may be a

AddDefaultCharset UTF-8
already specified in the Apache configuration, but the location depends on how the server is set up. For example, on my Ubuntu 5.04 server (Apache 2.0.53), there is a specific config include file for the charset which is found here:

/etc/apache2/conf.d/charset

I have commented out the entry as a charset sent as a HTTP header for every request (which is what

AddDefaultCharset
does) overrides a charset defined in the document, which is bad news if you are running several sites which use different charsets.

White Gandalf

10:21 pm on May 28, 2006 (gmt 0)

10+ Year Member



Well, in fact there was not any AddDefaultCharset when i configured it at first time, exactly because i read about the deprecation of that config option and because i usually use meta tags in all html files.

It is, however, not desturbing me at the moment, if there is an AddDefaultCharset directive with value iso-8859-1, as it is at the moment for testing purpose.

But the directory listing, which i want to use for certain directories, and particularly the http-header for the charset used for this generated listing, does not change by that directive anyways.
(I DO restart the server after changes, as well as restarting the browsers and changing something on the file system to be absolutely sure to get the listing data reloaded!)

It is an apache 2.0.55 with SSL support, running on a year-2000-computer (well, somewhat old) under a good old (and legal) Windows 98 (see
[harryboeck.dyndns.org...]
for some info from where i got it and how i configured it).

Well - the http headers i mentioned are those shown by the "live http headers" plugin for firefox. I have not really traced the TCP-throughput, but that should be the same, doesn't it?

White Gandalf

10:27 pm on May 28, 2006 (gmt 0)

10+ Year Member



After all - isn't it a bit strange that the apache is delivering UTF-8 just on a windows 98 system?
Shouldn't it be achievable to get simple plain extended ASCII out of that rascal?