diff options
-rw-r--r-- | test/webrick/test_filehandler.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb index ffd10cc529..1d2895f8ca 100644 --- a/test/webrick/test_filehandler.rb +++ b/test/webrick/test_filehandler.rb @@ -294,8 +294,13 @@ 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".encode("filesystem").bytes.map {|b| "%%%X" % b }.join - req = Net::HTTP::Get.new("/#{ filesystem_path }.txt") + case enc = Encoding.find('filesystem') + when Encoding::US_ASCII, Encoding::ASCII_8BIT + filesystem_path = "\u3042" + else + filesystem_path = "\u3042".encode("filesystem") + 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')}") } end end |