diff options
author | Kazuhiro NISHIYAMA <zn@mbf.nifty.com> | 2020-06-20 00:17:07 +0900 |
---|---|---|
committer | Kazuhiro NISHIYAMA <zn@mbf.nifty.com> | 2020-06-20 00:17:07 +0900 |
commit | 640e6c9be61d8f9d349f4e70869d0ac23cda7b0c (patch) | |
tree | 947e9a72a5794699660c061efb66b709db88df90 /test/webrick/test_filehandler.rb | |
parent | 32e2440a66366c712808e4bd03d9978861643a9e (diff) |
Use section sign instead of Hiragana Letter A
It can convert to Windows-1252and Windows-31J.
```
"\u00a7".encode("Windows-1252") #=> "\xA7"
"\u00a7".encode("Windows-31J") #=> "\x{8198}"
```
https://github.com/ruby/ruby/runs/788357527?check_suite_focus=true#step:14:959
```
1) Failure:
WEBrick::TestFileHandler#test_cjk_in_path [D:/a/ruby/ruby/src/test/webrick/utils.rb:72]:
exceptions on 2 threads:
webrick log start:
[2020-06-19 14:49:38] ERROR Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and Windows-1252
D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:341:in `+'
D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:341:in `set_filename'
D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:310:in `exec_handler'
D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:245:in `do_GET'
D:/a/ruby/ruby/src/lib/webrick/httpservlet/abstract.rb:105:in `service'
D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:241:in `service'
D:/a/ruby/ruby/src/lib/webrick/httpserver.rb:140:in `service'
D:/a/ruby/ruby/src/lib/webrick/httpserver.rb:96:in `run'
D:/a/ruby/ruby/src/lib/webrick/server.rb:307:in `block in start_thread'
```
Diffstat (limited to 'test/webrick/test_filehandler.rb')
-rw-r--r-- | test/webrick/test_filehandler.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb index d6fa4e2f15..fca073d08f 100644 --- a/test/webrick/test_filehandler.rb +++ b/test/webrick/test_filehandler.rb @@ -288,9 +288,9 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase end end - def test_cjk_in_path - Dir.mktmpdir("\u3042") do |dir| - File.write("#{dir}/\u3042.txt", "test_cjk_in_path") + def test_multibyte_char_in_path + Dir.mktmpdir("\u00a7") do |dir| + File.write("#{dir}/\u00a7.txt", "test_multibyte_char_in_path") begin dir = dir.encode('filesystem') rescue EncodingError @@ -300,9 +300,9 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase TestWEBrick.start_httpserver(config) do |server, addr, port, log| http = Net::HTTP.new(addr, port) begin - path = "/\u3042.txt".encode('filesystem') + path = "/\u00a7.txt".encode('filesystem') rescue EncodingError - path = "/\u3042.txt".force_encoding(Encoding::ASCII_8BIT) + path = "/\u00a7.txt".force_encoding(Encoding::ASCII_8BIT) end req = Net::HTTP::Get.new(WEBrick::HTTPUtils::escape(path)) http.request(req){|res| assert_equal("200", res.code, log.call + "\nFilesystem encoding is #{Encoding.find('filesystem')}") } |