Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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