I am trying to create an array with Danish characters - why are the characters converted to UTF-8 when output by PHP? Apache's httpd.conf? PHP.ini?
// Fails
$chars = array_merge(range("A","Z"),str_split("ÆØÅ"));
// Observed result: (array) ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
// Expected result: (array) ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
// Works
$chars = array_merge(range("A","Z"),str_split(utf8_decode("ÆØÅ")));
// Observed result: (array) ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
I have tried to set Content Type and Default Charset to ISO-8859-1 in the document top:
header('Content-type: text/html; charset=ISO-8859-1');
ini_set('default_charset', 'ISO-8859-1');
Content Type is also set in the HTML document (while this is not relevant since the issue occurs in the PHP engine, before HTML is output):
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">