[eluser]alexsancho[/eluser]
I address the same issue, and finally solves it extending Output class,
Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class MY_Output extends CI_Output
{
var $json;
var $xhtml = false;
var $mime = 'text/html';
function MY_Output()
{
parent::CI_Output();
$this->_mimeType();
}
function _mimeType()
{
if(isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') || strstr($_SERVER['HTTP_USER_AGENT'], 'WDG_SiteValidator') || strstr($_SERVER['HTTP_USER_AGENT'], 'W3C-checklink') || strstr($_SERVER['HTTP_USER_AGENT'], 'Web-Sniffer') || strstr($_SERVER['HTTP_USER_AGENT'], 'FeedValidator') || strstr($_SERVER['HTTP_USER_AGENT'], 'Poodle predictor') || strstr($_SERVER['HTTP_USER_AGENT'], 'Leknor.com gzip tester')) {
$this->mime = 'application/xhtml+xml';
$this->xhtml = true;
} else {
if(isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) {
if(preg_match("/application\/xhtml\+xml;q=([01]|0\.\d{1,3}|1\.0)/i", $_SERVER['HTTP_ACCEPT'], $matches)) {
$xhtml_q = $matches[1];
if(preg_match("/text\/html;q=q=([01]|0\.\d{1,3}|1\.0)/i", $_SERVER['HTTP_ACCEPT'], $matches)) {
$html_q = $matches[1];
if((float)$xhtml_q >= (float)$html_q) {
$this->mime = 'application/xhtml+xml';
$this->xhtml = true;
}
}
} else {
$this->mime = 'application/xhtml+xml';
$this->xhtml = true;
}
}
}
$this->set_header("Content-type: ".$this->mime."; charset=UTF-8");
}
}
Regards