3

This question is specifically about the charset Apache (2.2 in my case) uses when serving it's default internal pages. For example, mod_autoindex directory listings, not-found ErrorDocument pages, 500-Internal Error pages, etc.

The charset Apache is currently using for these built-in pages is iso-8859-1 (see screenshot).

enter image description here

Here are my relevant Apache settings:

# apache2.conf:

AddDefaultCharset utf-8

My OS is Debian 7 and I'm using it's default prefork binary. I was thinking the charsets on these pages might not be changeable. Or maybe there is a compile-time option that affects the default charset?

And in my (Debian-specific) /etc/apache2/envvars, I sourced my default locale:

$ cat /etc/apache2/envvars
. /etc/default/locale

$ cat /etc/default/locale
LANG="en_US.UTF-8

$ env | grep LANG
LANG=en_US.UTF-8

Modifying the Content-Type header with mod_headers has no affect on Apache's default internal pages.

Jeff
  • 1,416
  • 3
  • 28
  • 50

1 Answers1

1

Yes it is possible. You can do this with a combination of ErrorDocument, <Location> and ForceType, as follows:

ErrorDocument 404 /404.html
<Location /404.html>
  ForceType "text/html; charset=utf-8"
</Location>
Unbeliever
  • 2,336
  • 1
  • 10
  • 19