ruby-changes:30303
From: nagachika <ko1@a...>
Date: Sat, 3 Aug 2013 22:27:16 +0900 (JST)
Subject: [ruby-changes:30303] nagachika:r42355 (ruby_2_0_0): merge revision(s) 42271: [Backport #8713]
nagachika 2013-08-03 22:27:01 +0900 (Sat, 03 Aug 2013) New Revision: 42355 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42355 Log: merge revision(s) 42271: [Backport #8713] * lib/uri/common.rb (URI.decode_www_form_component): Don't raise error when str includes multibyte characters. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/uri/common.rb branches/ruby_2_0_0/test/uri/test_common.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42354) +++ ruby_2_0_0/ChangeLog (revision 42355) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Sat Aug 3 22:24:44 2013 Shota Fukumori <her@s...> + + * lib/uri/common.rb (URI.decode_www_form_component): + Don't raise error when str includes multibyte characters. + Sun Jul 28 22:00:10 2013 Nobuyoshi Nakada <nobu@r...> * rational.c (f_round_common): Rational is expected to be returned by Index: ruby_2_0_0/lib/uri/common.rb =================================================================== --- ruby_2_0_0/lib/uri/common.rb (revision 42354) +++ ruby_2_0_0/lib/uri/common.rb (revision 42355) @@ -896,7 +896,9 @@ module URI https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/uri/common.rb#L896 # 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+. Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 42354) +++ ruby_2_0_0/version.h (revision 42355) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-08-03" -#define RUBY_PATCHLEVEL 284 +#define RUBY_PATCHLEVEL 285 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_0_0/test/uri/test_common.rb =================================================================== --- ruby_2_0_0/test/uri/test_common.rb (revision 42354) +++ ruby_2_0_0/test/uri/test_common.rb (revision 42355) @@ -69,6 +69,9 @@ class TestCommon < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/uri/test_common.rb#L69 "AZ%5B%5C%5D%5E_%60az%7B%7C%7D%7E")) assert_equal("\xA1\xA2".force_encoding(Encoding::EUC_JP), URI.decode_www_form_component("%A1%A2", "EUC-JP")) + assert_equal("\xE3\x81\x82\xE3\x81\x82".force_encoding("UTF-8"), + URI.decode_www_form_component("\xE3\x81\x82%E3%81%82".force_encoding("UTF-8"))) + assert_raise(ArgumentError){URI.decode_www_form_component("%")} end Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r42271 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/