note 120054 added to ini.core

From: Date: Mon, 17 Oct 2016 20:06:27 +0000
Subject: note 120054 added to ini.core
Groups: php.notes 
Request: Send a blank email to php-notes+get-206910@lists.php.net to get a copy of this message
This might help in case someone happens to maintain old applications with a charset other than utf-8. According to the docs, you can override the default charset if you use header(). Suppose php.ini sets the default_charset to "UTF-8", but you need a legacy charset, like ISO-8859-1. Still, <?php header('Content-Type: text/html; Charset=ISO-8859-1'); ?> would not override the charset, just add it as well and the result was a response header like (note the two charsets): Content-Type:"text/html; Charset=ISO-8859-1;charset=UTF-8" I found it strange the default one as charset with a lowercase c as opposed to my custom charset with an uppercase C. What solved was to _override_ the charset using all lowercase letters as well for the word “charset”: <?php header('content-type: text/html; charset=ISO-8859-1'); ?> Then, the double charset from the response headers disappeared, and only the single, custom charset remained. ---- Server IP: 72.52.91.14 Probable Submitter: 177.82.167.249 ---- Manual Page -- http://php.net/manual/en/ini.core.php Edit -- https://master.php.net/note/edit/120054 Del: integrated -- https://master.php.net/note/delete/120054/integrated Del: useless -- https://master.php.net/note/delete/120054/useless Del: bad code -- https://master.php.net/note/delete/120054/bad+code Del: spam -- https://master.php.net/note/delete/120054/spam Del: non-english -- https://master.php.net/note/delete/120054/non-english Del: in docs -- https://master.php.net/note/delete/120054/in+docs Del: other reasons-- https://master.php.net/note/delete/120054 Reject -- https://master.php.net/note/reject/120054 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206910) next »