app/validators/url_validator.rb
# Unescape but do *not* force an encoding (so we can force it separately
# and check for validity).
# This used to be provided by URL.unescape, but that's obsolete and
# we want this to keep working *even* if URL.unescape is dropped.
# Based on Ruby's CGI "unescape" in cgi/util.rb
Unescape but do *not* force an encoding (so we can force it separately
and check for validity).
This used to be provided by URL.unescape, but that's obsolete and
we want this to keep working *even* if URL.unescape is dropped.
Based on Ruby's CGI "unescape" in cgi/util.rb
Unescape but do * not * force an encoding ( so we can force it separately and check for validity ) . This used to be provided by URL . unescape but that ' s obsolete and we want this to keep working * even * if URL . unescape is dropped . Based on Ruby ' s CGI " unescape " in cgi / util . rb
def unescape_unforced(string)
    str =
      string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do |m|
        [m.delete('%')].pack('H*')
      end
    str
  end
def unescape_unforced ( string ) str = string . tr ( '+' , ' ' ) . b . gsub ( / ((?:%[0-9a-fA-F]{2})+) / ) do | m | [ m . delete ( '%' ) ] . pack ( 'H*' ) end str end
Unescape but do *not* force an encoding (so we can force it separately
and check for validity).
Unescape but do * not * force an encoding ( so we can force it separately and check for validity ) .
string
<not_specific>