ruby-changes:8159
From: naruse <ko1@a...>
Date: Sun, 5 Oct 2008 17:51:36 +0900 (JST)
Subject: [ruby-changes:8159] Ruby:r19687 (trunk): * lib/open-uri.rb (OpenURI.open_uri): set encoding to strio.
naruse 2008-10-05 17:51:22 +0900 (Sun, 05 Oct 2008) New Revision: 19687 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19687 Log: * lib/open-uri.rb (OpenURI.open_uri): set encoding to strio. Modified files: trunk/ChangeLog trunk/lib/open-uri.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 19686) +++ ChangeLog (revision 19687) @@ -1,3 +1,7 @@ +Sun Oct 5 17:49:35 2008 NARUSE, Yui <naruse@r...> + + * lib/open-uri.rb (OpenURI.open_uri): set encoding to strio. + Sun Oct 5 17:39:21 2008 NARUSE, Yui <naruse@r...> * ext/stringio/stringio.c (strio_set_encoding): defined for Index: lib/open-uri.rb =================================================================== --- lib/open-uri.rb (revision 19686) +++ lib/open-uri.rb (revision 19687) @@ -132,6 +132,11 @@ 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 @@ end io = open_loop(uri, options) + io.set_encoding(encoding) if encoding + p [encoding, io.external_encoding] if block_given? begin yield io -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/