def initialize(uri=nil, response=nil, body=nil, code=nil, mech=nil)
@encoding = nil
response.each do |header,v|
next unless v =~ /charset/i
@encoding = v.split('=').last.strip
end
@encoding ||= Util.detect_charset(body)
body = Util.to_native_charset(body, @encoding) rescue body
super(uri, response, body, code)
@mech ||= mech
raise Mechanize::ContentTypeError.new(response['content-type']) unless
response['content-type'] =~ /^(text\/html)|(application\/xhtml\+xml)/i
@parser = @links = @forms = @meta = @bases = @frames = @iframes = nil
end