mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 09:33:59 +02:00
merge revision(s) 42271: [Backport #8713]
* 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/branches/ruby_2_0_0@42355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
65fcd2e738
commit
a1525108b8
4 changed files with 12 additions and 2 deletions
|
@ -896,7 +896,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+.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue