[前][次][番号順一覧][スレッド一覧]

ruby-changes:61765

From: Yusuke <ko1@a...>
Date: Thu, 18 Jun 2020 10:19:35 +0900 (JST)
Subject: [ruby-changes:61765] 5755397064 (master): test/webrick/test_filehandler.rb: implicitly fall back to UTF-8

https://git.ruby-lang.org/ruby.git/commit/?id=5755397064

From 575539706496875ab36111d32f3d9ef2b9376854 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 18 Jun 2020 10:18:32 +0900
Subject: test/webrick/test_filehandler.rb: implicitly fall back to UTF-8

https://ci.appveyor.com/project/ruby/ruby/builds/33588714/job/hcgin7xo3sarr0r2
```
  2) Failure:
WEBrick::TestFileHandler#test_cjk_in_path
[D:/a/ruby/ruby/src/test/webrick/utils.rb:72]:
exceptions on 1 threads:
U+3042 to WINDOWS-1252 in conversion from UTF-8 to WINDOWS-1252
```

diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb
index 70fa01a..992850c 100644
--- a/test/webrick/test_filehandler.rb
+++ b/test/webrick/test_filehandler.rb
@@ -294,11 +294,14 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L294
       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')}") }
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]