From 5f51cb9fc12a9d871f84cc3492dfd5f6e57f04c2 Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 4 Mar 2009 09:21:12 +0000 Subject: merges r22706 from trunk into ruby_1_9_1. -- * lib/uri/common.rb (URI::Parser#escape): escaped string is ascii only. * lib/uri/common.rb (URI::Parser#unescape): converts bytewise. [ruby-dev:38005], [ruby-dev:38110] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@22760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ lib/uri/common.rb | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 241dbcbdb..07f79f5ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Mar 2 19:43:02 2009 Nobuyoshi Nakada + + * lib/uri/common.rb (URI::Parser#escape): escaped string is ascii + only. + + * lib/uri/common.rb (URI::Parser#unescape): converts bytewise. + [ruby-dev:38005], [ruby-dev:38110] + Mon Mar 2 10:50:53 2009 Nobuyoshi Nakada * ext/dl/handle.c (rb_dlhandle_sym): get rid of buffer overrun, diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 9a6a06894..827ed7883 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -223,11 +223,11 @@ module URI tmp << sprintf('%%%02X', uc) end tmp - end + end.force_encoding(Encoding::US_ASCII) end def unescape(str, escaped = @regexp[:ESCAPED]) - str.gsub(escaped) { [$&[1, 2].hex].pack('U') } + str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(str.encoding) end @@to_s = Kernel.instance_method(:to_s) -- cgit