Thursday 16 August 2018

How to know the default charset of apache/php



When the character set is not specified either in httpd.conf, or php.ini, or .htaccess etc, then what is the default character set used by the apache server/php?



The browser considers it to be ISO-8859-1 when the response header does not include any character set information but I could not find any confirmation that the apache server/php actually sends the data with ISO-8859-1 encoding in response.



Thanks


Answer



The default value for default_charset is "iso-8859-1", which is applied to all pages served by PHP.




For Apache, the default character set for text and html is mandated by AddDefaultCharset which also has a default of "iso-8859-1".


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...