lib/www/mechanize/chain/response_header_handler.rb in mechanize-0.9.0 vs lib/www/mechanize/chain/response_header_handler.rb in mechanize-0.9.1
- old
+ new
@@ -24,11 +24,11 @@
k, v = option.split(/=/)
cache_obj[:keep_alive_options] ||= {}
cache_obj[:keep_alive_options][k.intern] = v
end
end
-
- if page.is_a?(Page) && page.body =~ /Set-Cookie/
+ body = Util.to_native_charset(page.body)
+ if page.is_a?(Page) && body =~ /Set-Cookie/
page.search('//meta[@http-equiv="Set-Cookie"]').each do |meta|
Cookie::parse(uri, meta['content']) { |c|
Mechanize.log.debug("saved cookie: #{c}") if Mechanize.log
@cookie_jar.add(uri, c)
}