On Fri, Oct 28, 2011 at 09:20, Nobuyoshi Nakada <nobu / ruby-lang.org> wrote: > (11/10/28 15:35), Nikolai Weibull wrote: >> Actually, it¡Çs probably easier than that. It can be done on a HFS+ >> filesystem (and probably any other, as well) just as easily > > It's not true. > >> % echo $LC_CTYPE >> UTF-8 >> % mkdir t >> % touch t/ >> % cat > a.rb >> # -*- coding: utf-8 -*- >> Dir.new('t').entries.each{ |e| printf "%p, %p, %s\n", e, e.encoding, >> File.file?(e) } >> ^D > > `e' doesn't have directory prefix, "t/". It can't stat. Ouch, of course. How stupid of me. That explains why it didn¡Çt work under 1.8.7 either. The point still remains valid on Windows, however: % mkdir t % touch t/¢ª % ruby -v -C t -e 'Dir.foreach(".") {|e| printf "%p, %p, %p\n", e, e.encoding, File.file?(e)}' ruby 1.9.3dev (2011-09-13 revision 33263) [i386-mingw32] ".", #<Encoding:Windows-1252>, false "..", #<Encoding:Windows-1252>, false "?", #<Encoding:Windows-1252>, false Hm, I guess here the result of Dir.foreach is broken. Here¡Çs another case: % ruby -v -rfind -e 'Find.find("t").each{ |e| printf "%p, %s, %p, %p\n", e, e.dump, e.encoding, File.file?(e)}' "t", "t", #<Encoding:UTF-8>, false "t/?", "t/?", #<Encoding:ASCII-8BIT>, false Equally broken, I guess.