I am trying to set default charset to ISO-8859-1, so I added the line below into httpd.conf.

AddDefaultCharset ISO-8859-9

and I can see that value when I query it with

root@server [/]# curl -A "Mozilla/4.0" http://localhost -I
HTTP/1.1 200 OK
Date: Mon, 10 Sep 2012 22:28:48 GMT
Server: Apache
Last-Modified: Tue, 21 Aug 2012 21:17:25 GMT
Accept-Ranges: bytes
Content-Length: 111
Content-Type: text/html; charset=ISO-8859-1

However, I can't get the same results for virtual hosts and there is no additional definitions for any other charset.

root@server [/]# file temp.php
temp.php: ISO-8859 text

root@server [/]# cat temp.php    
Cesária Évora

root@server [/]# curl -A "Mozilla/4.0" http://somedomain/temp.php -I
HTTP/1.1 200 OK
Date: Mon, 10 Sep 2012 22:28:31 GMT
Server: Apache
Content-Type: text/html; charset=utf-8

Do you have any idea ? Please let me know if you have a clue.

Thank you.


The charset attribute in Content-Type for PHP is handled by php.ini.

Add default_charset = iso-8859-1 to your php.ini or use ini_set( "default_charset", "iso-8859-1" ) in your temp.php. http://www.php.net/ini.core#ini.default-charset

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.