CodeIgniter Forums
Strange Content-Type header - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Strange Content-Type header (/showthread.php?tid=9742)



Strange Content-Type header - El Forum - 07-07-2008

[eluser]bAum[/eluser]
Dear All,

I am currently having a problem with with the encoding of the page. The problem is that what is sent is encoded in UTF-8, yet the browser thinks its ISO-8859-1. This is because one of the HTTP headers that is sent along with the page reads:

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

I don't see where this header is coming from, given that:
- The charset setting in the config file of CodeIgniter is set to "UTF-8".
- In the php.ini, no default charset is set.
- I have a meta-header that reads <meta http-equiv="content-type" content="text/html;charset=UTF-8">

Yet for some strange reason, this ISO-8859-1 is set as part of the headers (it is actually the last header, the whole sequence being Response, Date, Server, X-Powered-By, Set-Cookie, Set-Cookie, Set-Cookie, Keep-Alive, Connection, Transfer-Encoding, Content-Type).

Does anyone have an idea what piece of code is actually setting this header, or whether it hasn't anything to do with CI in the first place?

Any help appreciated.

Cheers,

baum


Strange Content-Type header - El Forum - 07-07-2008

[eluser]bAum[/eluser]
Now after some trying around, the header "Content-Type: text/html;charset=iso-8859-1" is gone, I don't know how that happened, maybe because I cleared the cache and restarted Firefox.

My output is now displaying correctly.


Strange Content-Type header - El Forum - 07-07-2008

[eluser]bAum[/eluser]
Again posted too quickly.

It wasn't clearing the cache and restarting Firefox that caused that header to disappear, but my colleague who was looking into the same problem. It turns out that there is a directive in Apache's httpd.conf that allows to add a header with a default charset (iso-8859-1) in case no such header is present. He disabled that directive around the time I cleared the Firefox cache, leading me to the wrong conclusion Smile