type = type.substring(0,semi)+"; charset="+charset;
{ _mimeType=type.substring(0,semi); _contentType= _mimeType += "; charset="+charset; }
    public void setLocale(Locale locale)    {        if (locale == null || isCommitted() ||_connection.isIncluding())            return;        _locale = locale;        _connection.getResponseFields().put(HttpHeaders.CONTENT_LANGUAGE_BUFFER,locale.toString().replace('_','-'));        if (this._outputState!=0 )            return;        /* get current MIME type from Content-Type header */        String type=getContentType();        if (type==null)        {            // servlet did not set Content-Type yet            // so lets assume default one            type="application/octet-stream";        }        String charset = _connection.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);        if (charset != null && charset.length()>0)        {            int semi=type.indexOf(';');            if (semi<0)                type += "; charset="+charset;            else if (!_explicitEncoding)                type = type.substring(0,semi)+"; charset="+charset;            _mimeType=type;            _cachedMimeType=MimeTypes.CACHE.get(_mimeType);            _characterEncoding=charset;                        _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,type);        }    }