From 588ac990ff170e2fb62e7ba0ed52a8088189cdbd Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 24 Sep 2020 21:41:11 +0900 Subject: [ruby/webrick] Manually pick commit from upstream repo Fix test when run with US-ASCII encoding https://github.com/ruby/webrick/commit/f402aafb36bbd43be54621405da550643a1a1a4c --- test/webrick/test_filehandler.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/webrick/test_filehandler.rb') diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb index 9674c176cf..998e03f690 100644 --- a/test/webrick/test_filehandler.rb +++ b/test/webrick/test_filehandler.rb @@ -291,6 +291,13 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase end def test_multibyte_char_in_path + if Encoding.default_external == Encoding.find('US-ASCII') + reset_encoding = true + verb = $VERBOSE + $VERBOSE = false + Encoding.default_external = Encoding.find('UTF-8') + end + c = "\u00a7" begin c = c.encode('filesystem') @@ -320,6 +327,11 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase } end end + ensure + if reset_encoding + Encoding.default_external = Encoding.find('US-ASCII') + $VERBOSE = verb + end end def test_script_disclosure -- cgit v1.2.3