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

* lib/net/http.rb (Net::HTTP#urlencode): str[0] returns char in 1.9.

Patch by Junegunn Choi [ruby-core:18368]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-08-24 03:21:36 +00:00
parent 7c2c7ea315
commit a65d2e0574
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sun Aug 24 12:15:12 2008 NARUSE, Yui <naruse@ruby-lang.org>
* 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@fsij.org>
* transcode.c (rb_econv_open): return NULL on error.

View file

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