aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2018-03-07 11:18:54 -0500
committerGitHub <noreply@github.com>2018-03-07 11:18:54 -0500
commit6a54932d43da3b24a1a8f41575cfe65c6a18c6bd (patch)
tree26b1a1e6c8e82a68c235bb461a3ef33c16907f64 /activesupport/lib
parentb5aa0266d0a4d5f7a02eb31df730fa172d1a845a (diff)
parente52ab312069a9af0c37c1666141752f3bc805054 (diff)
downloadrails-6a54932d43da3b24a1a8f41575cfe65c6a18c6bd.tar.gz
rails-6a54932d43da3b24a1a8f41575cfe65c6a18c6bd.tar.bz2
rails-6a54932d43da3b24a1a8f41575cfe65c6a18c6bd.zip
Merge pull request #32183 from kivikakk/uri-ext-fix
URI.unescape "extension" fails with Unicode input
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/uri.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb
index c93c0b5c2d..c4ac0baa32 100644
--- a/activesupport/lib/active_support/core_ext/uri.rb
+++ b/activesupport/lib/active_support/core_ext/uri.rb
@@ -13,7 +13,7 @@ unless str == parser.unescape(parser.escape(str))
# YK: My initial experiments say yes, but let's be sure please
enc = str.encoding
enc = Encoding::UTF_8 if enc == Encoding::US_ASCII
- str.gsub(escaped) { |match| [match[1, 2].hex].pack("C") }.force_encoding(enc)
+ str.dup.force_encoding(Encoding::ASCII_8BIT).gsub(escaped) { |match| [match[1, 2].hex].pack("C") }.force_encoding(enc)
end
end
end