summaryrefslogtreecommitdiff
path: root/test/webrick/test_filehandler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/webrick/test_filehandler.rb')
-rw-r--r--test/webrick/test_filehandler.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb
index 70fa01aba6..992850c1c2 100644
--- a/test/webrick/test_filehandler.rb
+++ b/test/webrick/test_filehandler.rb
@@ -294,11 +294,14 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
config = { :DocumentRoot => dir }
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
http = Net::HTTP.new(addr, port)
+ filesystem_path = "\u3042"
case Encoding.find('filesystem')
when Encoding::US_ASCII, Encoding::ASCII_8BIT
- filesystem_path = "\u3042"
else
- filesystem_path = "\u3042".encode("filesystem")
+ begin
+ filesystem_path = "\u3042".encode("filesystem")
+ rescue Encoding::UndefinedConversionError
+ end
end
req = Net::HTTP::Get.new("/#{ filesystem_path.bytes.map {|b| "%%%X" % b }.join }.txt")
http.request(req){|res| assert_equal("200", res.code, log.call + "\nFilesystem encoding is #{Encoding.find('filesystem')}") }