1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/open-uri.rb (OpenURI.open_uri): set encoding to strio.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-10-05 08:51:22 +00:00
parent fd898245cb
commit f09149cab5
2 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Sun Oct 5 17:49:35 2008 NARUSE, Yui <naruse@ruby-lang.org>
* lib/open-uri.rb (OpenURI.open_uri): set encoding to strio.
Sun Oct 5 17:39:21 2008 NARUSE, Yui <naruse@ruby-lang.org>
* ext/stringio/stringio.c (strio_set_encoding): defined for

View file

@ -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