Skip to content

Commit

Permalink
Only call String#force_encoding if the method exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
eric committed Jun 25, 2009
1 parent f7b22de commit 7fd877c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/www/mechanize/page.rb
Expand Up @@ -34,7 +34,7 @@ def initialize(uri=nil, response=nil, body=nil, code=nil, mech=nil)

# Force the encoding to be 8BIT so we can perform regular expressions.
# We'll set it to the detected encoding later
body.force_encoding('ASCII-8BIT') if defined?(Encoding) && body
body.force_encoding('ASCII-8BIT') if defined?(Encoding) && body && body.respond_to?(:force_encoding)

@encoding ||= Util.detect_charset(body)

Expand Down

0 comments on commit 7fd877c

Please sign in to comment.