Skip to main content
  1. Posts/

Change the default Apache character set

·120 words·1 min·

By default, Red Hat Enterprise Linux 4 sets the default character set in Apache to UTF-8. Your specific web application may need for the character set to be set to a different value, and the change can be made fairly easily. Here’s an example where the character set is changed to ISO-8859-1:

First, adjust the AddDefaultCharset directive in /etc/httpd/conf/httpd.conf:

#AddDefaultCharset UTF-8<br />
AddDefaultCharset ISO-8859-1

Then, reload Apache and check your headers:

# /etc/init.d/httpd reload<br />
# curl -I localhost<br />
HTTP/1.1 403 Forbidden<br />
Date: Thu, 08 Nov 2007 22:18:14 GMT<br />
Server: Apache/2.0.52 (Red Hat)<br />
Accept-Ranges: bytes<br />
Content-Length: 3985<br />
Connection: close<br />
Content-Type: text/html; charset=ISO-8859-1

This was tested on Red Hat Enterprise Linux 4 Update 5