Hi,

In message "[BUG?] UTF8 ruby and win32 dir"
    on 03/08/05, Pierre Baillet <oct / zoy.org> writes:

|not sure at all about this one, but on my windows XP pro French, 
|
|doing a Dir.entries.each on a folder with accented letter doesn't gives
|UTF-8 back but rather the local encoding for my filesystem :
|
|in a folder containing the sub-folders: 
|tt
|fl 
|
|this script:
|file = File.open("ouput.txt","w").binmode
|Dir.new("d:/test_accent").each{ |dir|
| file.puts dir
| }
|
|spits out a latin1 file (windows-1252, i guess) and not a unicode one
|when run using ruby -KU.

Ruby does not convert encodings implicitly, even when you specify -Ku.
-Ku means "treating data as in UTF-8", not "converting incoming data
into UTF-8".

So if underlying OS (Windows XP, this case) gives Ruby file names in
Latin-1, or any other encoding, Ruby passes them to you directly.
Blame Microsoft for not giving file names in your favorite encoding,
and convert them to UTF-8 by yourself.

							matz.