summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/net/http.rb2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f78b4c044..b241b3899 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
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