lib/rack/utf8_sanitizer.rb
# RFC3986, 2.2 states that the characters from 'reserved' group must be
# protected during normalization (which is what UTF8Sanitizer does).
#
# However, the regexp approach used by URI.unescape is not sophisticated
# enough for our task.
RFC3986, 2.2 states that the characters from 'reserved' group must be
protected during normalization (which is what UTF8Sanitizer does).

However, the regexp approach used by URI.unescape is not sophisticated
enough for our task.
RFC3986 2 . 2 states that the characters from ' reserved ' group must be protected during normalization ( which is what UTF8Sanitizer does ) . However the regexp approach used by URI . unescape is not sophisticated enough for our task .
def unescape_unreserved(input)
      input.gsub(/%([a-f\d]{2})/i) do |encoded|
        decoded = [$1.hex].pack('C')
        if decoded =~ UNRESERVED_OR_UTF8
          decoded
        else
          encoded
        end
      end
    end
def unescape_unreserved ( input ) input . gsub ( / %([a-f \d ]{2}) /i ) do | encoded | decoded = [ $1 . hex ] . pack ( 'C' ) if decoded =~ UNRESERVED_OR_UTF8 decoded else encoded end end end
RFC3986, 2.2 states that the characters from 'reserved' group must be
protected during normalization (which is what UTF8Sanitizer does).
RFC3986 2 . 2 states that the characters from ' reserved ' group must be protected during normalization ( which is what UTF8Sanitizer does ) .
input
<not_specific>