J
johan556
Hi!
I use Ruby on Windows, and tried to remove all files in a directory
with the code given below. But if the directory contains files with
filenames having non-western characters the operation fails.
I first encountered this problem when using FileUtils.rm_r, and that
method also fails (for the same reason I guess). This makes FileUtils
quite useless in some situations. We have for example Subversion
projects that contain files with Japanese characters (for testing that
our product works with such characters), and I also tried with Arabic
characters (stored in Unicode in NTFS in both cases).
Is it possible to get Ruby to work with filenames containing
non-western characters at all on Windows? If so, what should I do?
/Johan Holmberg
--------------
Dir.chdir "nonwestern-files"
for entry in Dir.entries(".")
next if entry == "."
next if entry == ".."
n = File.unlink(entry)
puts "failed to delete #{entry}" if n == 0
end
--------------
I use Ruby on Windows, and tried to remove all files in a directory
with the code given below. But if the directory contains files with
filenames having non-western characters the operation fails.
I first encountered this problem when using FileUtils.rm_r, and that
method also fails (for the same reason I guess). This makes FileUtils
quite useless in some situations. We have for example Subversion
projects that contain files with Japanese characters (for testing that
our product works with such characters), and I also tried with Arabic
characters (stored in Unicode in NTFS in both cases).
Is it possible to get Ruby to work with filenames containing
non-western characters at all on Windows? If so, what should I do?
/Johan Holmberg
--------------
Dir.chdir "nonwestern-files"
for entry in Dir.entries(".")
next if entry == "."
next if entry == ".."
n = File.unlink(entry)
puts "failed to delete #{entry}" if n == 0
end
--------------