summaryrefslogtreecommitdiff
path: root/lib/cgi/util.rb
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-17 12:34:59 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-17 12:34:59 +0000
commite1b432754553423008a14d39d0901eabc99e7ddb (patch)
tree743e46d6fefc2ee305acf363ec966ce3126a0d56 /lib/cgi/util.rb
parent53127c2410c29f7cc942a76baa7be97ba65aafda (diff)
cgi/util.rb: Don't escape tilde in #escape
to make it compatible with ERB::Util.url_encode. ext/cgi/escape/escape.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi/util.rb')
-rw-r--r--lib/cgi/util.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
index 18eaf443757..464115262f6 100644
--- a/lib/cgi/util.rb
+++ b/lib/cgi/util.rb
@@ -11,7 +11,7 @@ module CGI::Util
# # => "%27Stop%21%27+said+Fred"
def escape(string)
encoding = string.encoding
- string.b.gsub(/([^ a-zA-Z0-9_.-]+)/) do |m|
+ string.b.gsub(/([^ a-zA-Z0-9_.\-~]+)/) do |m|
'%' + m.unpack('H2' * m.bytesize).join('%').upcase
end.tr(' ', '+').force_encoding(encoding)
end