views:

214

answers:

1

i was writing a script on Windows Vista to move the files in a folder to another hard drive, but found that Ruby 1.8.6 or 1.9 both would get back filenames with Unicode characters in it replaced by "??????"

so for example, the filename "Chart for ???????.doc" is returned

so the file cannot be moved at all...

i used

filename.each_byte {|x| p x}

to make sure it is internally really "?" characters inside the string, not just when it is printed out.

+1  A: 

Ruby supports utf8, but not multibyte. You have to use third libraries as http://ruby-unicode.rubyforge.org/doc/

MickTaiwan