public function negotiateCharset($supported, $default = 'ISO-8859-1')
    {
        $supp = array();
        foreach ($supported as $charset) {
            $supp[strtolower($charset)] = $charset;
        }

        if (!count($supp)) {
            return $default;
        }

        if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) {
            $match = $this->matchAccept(
                $_SERVER['HTTP_ACCEPT_CHARSET'],
                $supp
            );

            if (!is_null($match)) {
                return $match;
            }
        }

        return $default;
    }