Can Ruby get the names of files in a folder if they have Unicode characters?

I was writing a script on Windows Vista to move files to a folder on a different hard drive, but found that Ruby 1.8.6 or 1.9 both return filenames with Unicode characters replaced with "??????"

So, for example, the file name "Chart for ???????. Doc" is returned and the file cannot be moved at all ...

I used

filename.each_byte {|x| p x}

      

to make sure that he is internally really "?" characters within a string, not just when printing it.

0


a source to share


1 answer


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



+1


a source







All Articles