Add a second parameter (charset) to CI_Output::set_content_type() + fix for issue #666
diff --git a/system/core/Output.php b/system/core/Output.php
index 0965671..0bf9822 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -200,7 +200,7 @@
* @param string extension of the file we're outputting
* @return void
*/
- public function set_content_type($mime_type)
+ public function set_content_type($mime_type, $charset = NULL)
{
if (strpos($mime_type, '/') === FALSE)
{
@@ -218,7 +218,13 @@
}
}
- $header = 'Content-Type: '.$mime_type;
+ if (empty($charset))
+ {
+ $charset = config_item('charset');
+ }
+
+ $header = 'Content-Type: '.$mime_type
+ .(empty($charset) ? NULL : '; charset='.strtolower($charset));
$this->headers[] = array($header, TRUE);
return $this;