* 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:
parent
fd898245cb
commit
f09149cab5
@ -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>
|
Sun Oct 5 17:39:21 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* ext/stringio/stringio.c (strio_set_encoding): defined for
|
* ext/stringio/stringio.c (strio_set_encoding): defined for
|
||||||
|
@ -132,6 +132,11 @@ module OpenURI
|
|||||||
options ||= {}
|
options ||= {}
|
||||||
OpenURI.check_options(options)
|
OpenURI.check_options(options)
|
||||||
|
|
||||||
|
if /\Arb?(?:\Z|:([^:]+))/ =~ mode
|
||||||
|
encoding, = $1,Encoding.find($1) if $1
|
||||||
|
mode = nil
|
||||||
|
end
|
||||||
|
|
||||||
unless mode == nil ||
|
unless mode == nil ||
|
||||||
mode == 'r' || mode == 'rb' ||
|
mode == 'r' || mode == 'rb' ||
|
||||||
mode == File::RDONLY
|
mode == File::RDONLY
|
||||||
@ -139,6 +144,8 @@ module OpenURI
|
|||||||
end
|
end
|
||||||
|
|
||||||
io = open_loop(uri, options)
|
io = open_loop(uri, options)
|
||||||
|
io.set_encoding(encoding) if encoding
|
||||||
|
p [encoding, io.external_encoding]
|
||||||
if block_given?
|
if block_given?
|
||||||
begin
|
begin
|
||||||
yield io
|
yield io
|
||||||
|
Loading…
x
Reference in New Issue
Block a user