I am configuring my Apache/2.2.17 server with PHP 5.3.5. My goal is to create a clean configuration which defaults to the content-type UTF-8.
php.ini:
default_charset = "UTF-8"
default_mimetype = "application/xhtml+xml"
I receive:
Content-Type: application/xhtml+xml
but require:
Content-Type: application/xhtml+xml; charset=UTF-8
All Apache's configuration (AddDefaultCharset UTF-8) solutions seem not to work, and I have restarted Apache after I edited my php.ini configuration.
PHP documentation:
default_charset string
PHP always outputs a character encoding by default in the Content-type: header. To disable sending of the charset, simply set it to be empty.
I've changed the default_mimetype field to text/html and suddenly, it seems to work: Content-Type:text/html; charset=UTF-8.
Settings the default_mimetype back to application/xhtml+xml will not send the charset=UTF-8. This is without any Apache configuration.
Is PHP broken, or have I missed something?