ruby-changes:7286
From: naruse <ko1@a...>
Date: Sun, 24 Aug 2008 12:21:54 +0900 (JST)
Subject: [ruby-changes:7286] Ruby:r18805 (trunk): * lib/net/http.rb (Net::HTTP#urlencode): str[0] returns char in 1.9.
naruse 2008-08-24 12:21:36 +0900 (Sun, 24 Aug 2008) New Revision: 18805 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18805 Log: * lib/net/http.rb (Net::HTTP#urlencode): str[0] returns char in 1.9. Patch by Junegunn Choi [ruby-core:18368] Modified files: trunk/ChangeLog trunk/lib/net/http.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 18804) +++ ChangeLog (revision 18805) @@ -1,3 +1,8 @@ +Sun Aug 24 12:15:12 2008 NARUSE, Yui <naruse@r...> + + * lib/net/http.rb (Net::HTTP#urlencode): str[0] returns char in 1.9. + Patch by Junegunn Choi [ruby-core:18368] + Sun Aug 24 12:02:39 2008 Tanaka Akira <akr@f...> * transcode.c (rb_econv_open): return NULL on error. Index: lib/net/http.rb =================================================================== --- lib/net/http.rb (revision 18804) +++ lib/net/http.rb (revision 18805) @@ -1526,7 +1526,7 @@ private :encode_kvpair def urlencode(str) - str.gsub(/[^a-zA-Z0-9_\.\-]/n) { sprintf('%%%02x', $&[0]) } + str.dup.force_encoding('ASCII-8BIT').gsub(/[^a-zA-Z0-9_\.\-]/){'%%%02x' % $&.ord} end private :urlencode -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/