Content-Type always uses UTF-8 encoding

Hi,
I’m using caddy to serve some simple PHP pages on an old server.
The files require a ISO-8859-1 encoding so I tried to override the default UTF-8 encoding as statet already here: Question: faulty charset?

The problem is that the resulting response from the server will have both Content-Types defined.
Actual:

Content-Type: text/html; charset=ISO-8859-1; text/html; charset=UTF-8

Firefox decides to use UTF-8 in this case…

Expected:

Content-Type: text/html; charset=ISO-8859-1

I tried both using the header and mime directives to change the Content-Type

:2015 {
  root /data/www/chr
  tls off
  fastcgi / 127.0.0.1:9000 {
    ext .php
    split .php
    index index.php
  }
  header / Content-Type "text/html; charset=ISO-8859-1"
}

:2015 {
  root /data/www/chr
  tls off
  fastcgi / 127.0.0.1:9000 {
    ext .php
    split .php
    index index.php
  }
  mime {
    .php "text/html; charset=ISO-8859-1"
  }
}

Both configurations have the same outcome. Am I doing something wrong? There has to be a way to do it :worried:

OS Red Hat Enterprise Linux Server release 6.4 (Santiago)
caddy 0.10.4
PHP 5.5

Ok it seems this UTF-8 Content-Type header comes from the PHP configuration itself (which in my case I don’t want to touch) http://php.net/manual/en/ini.core.php#ini.default-charset.
It doesn’t seem that I can overwrite it with caddy? :slightly_frowning_face:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.