From: merch-redmine@... Date: 2019-08-08T20:54:39+00:00 Subject: [ruby-dev:50830] [Ruby master Bug#7881] Windows でパスに日本語を含むスクリプトからの require が失敗する Issue #7881 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Assigned to Closed This appears to have been fixed between Ruby 2.4 and 2.5: ``` D:\テスト>c:\Ruby24-x64\bin\ruby a.rb a.rb: No such file or directory @ realpath_rec - D:/??? (Errno::ENOENT) D:\テスト>c:\Ruby25-x64\bin\ruby a.rb No Problem. ``` ---------------------------------------- Bug #7881: Windows でパスに日本語を含むスクリプトからの require が失敗する https://bugs.ruby-lang.org/issues/7881#change-80501 * Author: 5.5 (5 5) * Status: Closed * Priority: Normal * Assignee: h.shirosaki (Hiroshi Shirosaki) * Target version: * ruby -v: ruby 1.9.3p385 (2013-02-06) [i386-mingw32] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- =begin Windows でパスに日本語を含むスクリプトからの require が失敗します。 Ruby 1.9.3 の p374,p385 でこの現象が起こりますが,p125 では起こりません。 p286 あたりから起こるようになったと思います。 【再現手順】 (1) d:/テスト というフォルダーを作る。 (2) d:/テスト/a.rb を下記のように書く。 (3) d:/テスト/b.rb を下記のように書く。 (4) cd /テスト (5) ruby a.rb a.rb の内容: # encoding: utf-8 require "./b" b.rb の内容 # encoding: utf-8 puts "No problem." これで, cannot load such file -- ./b (LoadError) が出ます。 * フォルダー名を「テスト」から「test」に変えると正常に動作します。 * a.rb のスクリプトエンコーディングを CP932 に変えると正常に動作します。 * require "./b" を require "./b".encode("CP932") に変えると正常に動作します。 * 標準添付ライブラリーや gem はふつうに require できます。 =end -- https://bugs.ruby-lang.org/