protected function fixContentType($contentType) { // add charset if needed (only on text content) if (false === stripos($contentType, 'charset') && (0 === stripos($contentType, 'text/') || strlen($contentType) - 3 === strripos($contentType, 'xml'))) { $contentType .= '; charset=' . $this->options['charset']; } // change the charset for the response if (preg_match('/charset\\s*=\\s*(.+)\\s*$/', $contentType, $match)) { $this->options['charset'] = $match[1]; } return $contentType; }