def charset
      type, *parameters = content_type_parse
      if pair = parameters.assoc('charset')
        pair.last.downcase
      elsif block_given?
        yield
      elsif type && %r{\Atext/} =~ type &&
            @base_uri && /\Ahttp\z/i =~ @base_uri.scheme
        "iso-8859-1" # RFC2616 3.7.1
      else
        nil
      end
    end
def charset
      type, *parameters = content_type_parse
      if pair = parameters.assoc('charset')
        pair.last.downcase
      elsif block_given?
        yield
      elsif type && %r{\Atext/} =~ type &&
            @base_uri && /\Ahttp\z/i =~ @base_uri.scheme
        "iso-8859-1" # RFC2616 3.7.1
      else
        nil
      end
    end
returns a charset parameter in Content-Type field.
 It is downcased for canonicalization.

 If charset parameter is not given but a block is given,
 the block is called and its result is returned.
 It can be used to guess charset.

 If charset parameter and block is not given,
 nil is returned except text type in HTTP.
 In that case, "iso-8859-1" is returned as defined by RFC2616 3.7.1.