diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/open-uri.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb index 01d8dd643f..be88b81079 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -414,12 +414,14 @@ module OpenURI def meta_setup_encoding # :nodoc: charset = self.charset - return unless charset - begin - enc = Encoding.find(charset) - rescue ArgumentError - return + enc = nil + if charset + begin + enc = Encoding.find(charset) + rescue ArgumentError + end end + enc = Encoding::ASCII_8BIT unless enc if self.respond_to? :force_encoding self.force_encoding(enc) elsif self.respond_to? :string |