diff options
| author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-05 08:51:22 +0000 |
|---|---|---|
| committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-05 08:51:22 +0000 |
| commit | d931e06f45580cc3e066a9056df1d9c15c28d15d (patch) | |
| tree | b9115255627abb264eace4e2b6fecd942857e1c1 /lib | |
| parent | cfff3ec1776a854da6c5311acebb3ee562734536 (diff) | |
| download | ruby-d931e06f45580cc3e066a9056df1d9c15c28d15d.tar.gz ruby-d931e06f45580cc3e066a9056df1d9c15c28d15d.tar.xz ruby-d931e06f45580cc3e066a9056df1d9c15c28d15d.zip | |
* lib/open-uri.rb (OpenURI.open_uri): set encoding to strio.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/open-uri.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb index c68aee6e9..03f5e6de4 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -132,6 +132,11 @@ module OpenURI options ||= {} OpenURI.check_options(options) + if /\Arb?(?:\Z|:([^:]+))/ =~ mode + encoding, = $1,Encoding.find($1) if $1 + mode = nil + end + unless mode == nil || mode == 'r' || mode == 'rb' || mode == File::RDONLY @@ -139,6 +144,8 @@ module OpenURI end io = open_loop(uri, options) + io.set_encoding(encoding) if encoding + p [encoding, io.external_encoding] if block_given? begin yield io |
