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

* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@22706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-03-02 10:43:04 +00:00
parent 5b35cbf5d3
commit 3f0060c042
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,11 @@
Mon Mar 2 19:43:02 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 16:40:11 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* README.EXT, README.EXT.ja (Macros): added HAVE_RUBY_*_H.

View file

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