diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-28 14:38:33 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-28 14:38:33 +0000 |
commit | 3e1c54defd58609ae284a78b3bc5501105d332e6 (patch) | |
tree | eb5c349e9d0c5be14703e281cab0c84dbbf7ee37 | |
parent | 5eafc201d8d27394f2bde9cd08f03c1dac36bbb8 (diff) | |
download | ruby-3e1c54defd58609ae284a78b3bc5501105d332e6.tar.gz |
* lib/open-uri.rb (OpenURI::Meta#meta_setup_encoding): use ASCII-8BIT
for charset unspecified non-text data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/open-uri.rb | 12 |
2 files changed, 12 insertions, 5 deletions
@@ -1,3 +1,8 @@ +Thu Feb 28 23:37:12 2008 Tanaka Akira <akr@fsij.org> + + * lib/open-uri.rb (OpenURI::Meta#meta_setup_encoding): use ASCII-8BIT + for charset unspecified non-text data. + Thu Feb 28 22:19:14 2008 NARUSE, Yui <naruse@ruby-lang.org> * encoding.c (enc_capable): IMMEDIATE_P doesn't include Qnil and Qfalse. 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 |