lib/www/mechanize/page.rb in tenderlove-mechanize-0.9.3.20090617085936 vs lib/www/mechanize/page.rb in tenderlove-mechanize-0.9.3.20090623142847

- old
+ new

@@ -55,13 +55,18 @@ end def encoding=(encoding) @encoding = encoding - if @parser && @parser.encoding.downcase != encoding.downcase - # lazy reinitialize the parser with the new encoding - @parser = nil + if @parser + parser_encoding = @parser.encoding + if (parser_encoding && parser_encoding.downcase) != (encoding && encoding.downcase) + # lazy reinitialize the parser with the new encoding + @parser = nil + end end + + encoding end def encoding parser.respond_to?(:encoding) ? parser.encoding : nil end