diff options
author | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-31 09:00:18 +0000 |
---|---|---|
committer | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-31 09:00:18 +0000 |
commit | b30a1723853bc1a189930a5c7ebdfc5ec7e4817b (patch) | |
tree | ecdd62d9e204447288ecfa91ce14a8ea2f43c383 /lib | |
parent | 37c05ec3ed1e7566acf54ccbbf90dfb1e790539c (diff) | |
download | ruby-b30a1723853bc1a189930a5c7ebdfc5ec7e4817b.tar.gz |
* lib/uri/common.rb (URI.decode_www_form_component):
Don't raise error when str includes multibyte characters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/uri/common.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 1da9f47647..8c657cdee7 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -899,7 +899,9 @@ module URI # See URI.encode_www_form_component, URI.decode_www_form def self.decode_www_form_component(str, enc=Encoding::UTF_8) raise ArgumentError, "invalid %-encoding (#{str})" unless /\A[^%]*(?:%\h\h[^%]*)*\z/ =~ str - str.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc) + str.dup.force_encoding("ASCII-8BIT") \ + .gsub(/\+|%\h\h/, TBLDECWWWCOMP_) \ + .force_encoding(enc) end # Generate URL-encoded form data from given +enum+. |