From 8607c25ba7810573733d9b37d0015154ba059f5e Mon Sep 17 00:00:00 2001 From: eileencodes Date: Fri, 12 May 2017 14:12:40 -0400 Subject: Maintain original encoding from path When the path info is read from the socket it's encoded as ASCII 8BIT. The unescape method changes the encoding to UTF8 but it should maintain the encoding of the string that's passed in. This causes parameters to be force encoded to UTF8 when we don't actually know what the encoding of the parameter should be. --- actionpack/test/journey/router/utils_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionpack/test/journey') diff --git a/actionpack/test/journey/router/utils_test.rb b/actionpack/test/journey/router/utils_test.rb index b77bf6628a..74277a4325 100644 --- a/actionpack/test/journey/router/utils_test.rb +++ b/actionpack/test/journey/router/utils_test.rb @@ -31,6 +31,11 @@ module ActionDispatch def test_normalize_path_uppercase assert_equal "/foo%AAbar%AAbaz", Utils.normalize_path("/foo%aabar%aabaz") end + + def test_normalize_path_maintains_string_encoding + path = "/foo%AAbar%AAbaz".b + assert_equal Encoding::ASCII_8BIT, Utils.normalize_path(path).encoding + end end end end -- cgit v1.2.3