From: Axel Etzold Date: 2008-08-25T23:08:54+09:00 Subject: Re: Moving all files in a folder to another hard drive -------- Original-Nachricht -------- > Datum: Mon, 25 Aug 2008 20:19:27 +0900 > Von: SpringFlowers AutumnMoon > An: ruby-talk@ruby-lang.org > Betreff: Re: Moving all files in a folder to another hard drive > no matter which of the two methods is used: > > files = Dir.new(basedir).entries > > Dir.chdir(basedir) > files = Dir.glob("*"); > > then if i do > > files.each { |file| > p i, file > file.each_byte {|c| print c, ' ' } > > then whenever the filename has international characters, then the ASCII > code 63 is printed out a lot, meaning it is "?". I wonder is it true > for Japanese version of Ruby too? Does it actually get back UTF-8 code > or JIS code? > > -- > Posted via http://www.ruby-forum.com/. As far as I know, East Asian encodings use more than one bit to store a character (due to the huge amout of characters, they wouldn't all fit into 256 places). This might explain why you get ? when you write each_byte there. I am not on Windows right now, so I am sure whether your international files all get copied to ?(repeat x times) or whether they are copied to names which are not correctly displayed in the file browser. What you could do is CGI.escape and (maybe later CGI.unescape) them: require "cgi" files.each { |file| p CGI.escape(file) # and then move files } That's not elegant, but it will produce names with only % and ASCII letters. How does rio behave under Windows (http://rio.rubyforge.org/) ? Best regards, Axel -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser