summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-02 10:43:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-02 10:43:04 +0000
commit140e6ab5c95dc468873c95d7a4b9b5faaa046fb6 (patch)
treeef0fd5c9b5eed9fea68e8fa68764f236ce2e1213 /lib
parentf18c96519a06209e85cdee493d4fd3914bae7838 (diff)
downloadruby-140e6ab5c95dc468873c95d7a4b9b5faaa046fb6.tar.gz
ruby-140e6ab5c95dc468873c95d7a4b9b5faaa046fb6.tar.xz
ruby-140e6ab5c95dc468873c95d7a4b9b5faaa046fb6.zip
* 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/trunk@22706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/uri/common.rb4
1 files changed, 2 insertions, 2 deletions
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)