diff options
-rw-r--r-- | lib/fileutils.rb | 10 | ||||
-rw-r--r-- | test/fileutils/test_fileutils.rb | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 438f3210f7..c8f4b49067 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -1557,7 +1557,15 @@ module FileUtils def join(dir, base) return File.path(dir) if not base or base == '.' return File.path(base) if not dir or dir == '.' - File.join(dir, base) + begin + File.join(dir, base) + rescue EncodingError + if fu_windows? + File.join(dir.encode(::Encoding::UTF_8), base.encode(::Encoding::UTF_8)) + else + raise + end + end end if File::ALT_SEPARATOR diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 274492da99..8a546ccf1b 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -771,9 +771,6 @@ class TestFileUtils < Test::Unit::TestCase remove_entry dir assert_file_not_exist dir - rescue MiniTest::Assertion - STDERR.puts Dir.glob("#{dir}/**/*").inspect - raise end def test_remove_entry_secure |