diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-02 10:43:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-02 10:43:04 +0000 |
commit | 3f0060c0426dd468964c3ec07b4c4d56d3894894 (patch) | |
tree | ef0fd5c9b5eed9fea68e8fa68764f236ce2e1213 | |
parent | 5b35cbf5d380eff0db01592be9b77e88e8897713 (diff) | |
download | ruby-3f0060c0426dd468964c3ec07b4c4d56d3894894.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | lib/uri/common.rb | 4 |
2 files changed, 10 insertions, 2 deletions
@@ -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. diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 9a6a06894a..827ed7883d 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) |