sfWebResponse::fixContentType PHP Method

fixContentType() protected method

Fixes the content type by adding the charset for text content types.
protected fixContentType ( string $contentType ) : string
$contentType string The content type
return string The content type with the charset if needed
    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;
    }