summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-24 03:21:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-24 03:21:36 +0000
commit03c2ee26f9daa4206eb9bb28980161d15a2b830e (patch)
tree0108504f372351a1da83921e3c3f2121280df311 /lib
parent486112cbca28f1899525dde697d139b41a35bf29 (diff)
downloadruby-03c2ee26f9daa4206eb9bb28980161d15a2b830e.tar.gz
ruby-03c2ee26f9daa4206eb9bb28980161d15a2b830e.tar.xz
ruby-03c2ee26f9daa4206eb9bb28980161d15a2b830e.zip
* lib/net/http.rb (Net::HTTP#urlencode): str[0] returns char in 1.9.
Patch by Junegunn Choi [ruby-core:18368] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/http.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index b3ddee54e..8e0c3b208 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1526,7 +1526,7 @@ module Net #:nodoc:
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