Hello Forum,
The newer ruby 193 has no problem with non-latin file names
$ c:/Ruby193/bin/ruby -e 'Dir.glob("folder/*").each{|f| puts f }'
folder/человеку медведь
$ c:/Ruby193/bin/ruby -e 'Dir.glob("folder/*/*").each{|f| puts f }'
folder/человеку медведь/свиньи
But the older ruby 187 does not deal well with these files:
$ c:/Ruby187/bin/ruby -e 'Dir.glob("folder/*").each{|f| puts f }'
folder/???????? ???????
Is there a fix for this, apart from upgrading to ruby 193 ?
- Bartels
on 2013-03-02 19:03
on 2013-03-02 19:16
On Sat, 02 Mar 2013 19:03:42 +0100, Bart Els <lists@ruby-forum.com> wrote: > > Most probably the encodings of the filenames you receive from Dir.glob are different than the encoding your console uses. (Although I have no idea which encoding these might be.) You might be able to use Iconv for converting them.
on 2013-03-02 22:21
Bartosz Dziewoński wrote in post #1099866: > On Sat, 02 Mar 2013 19:03:42 +0100, Bart Els <lists@ruby-forum.com> > wrote: > >> >> > Most probably the encodings of the filenames you receive from Dir.glob > are different than the encoding your console uses. (Although I have no > idea which encoding these might be.) > > You might be able to use Iconv for converting them. Hmm, thanks for your time, but encoding it is not: our poor 'man bear' is translated into a series of 0xf3 characters, with a 0x02 in between. $ c:/Ruby187/bin/ruby -e 'Dir.glob("folder/*").each{|f| puts f.unpack("h*") }' 66f6c6465627f2f3f3f3f3f3f3f3f302f3f3f3f3f3f3f3 Plus, I get nothing where I would expect exactly one file a level deeper: $ c:/Ruby187/bin/ruby -e 'puts Dir.glob("folder/*/*").each{|f| puts f }.size' 0 The same for 193 gives me my file: $ c:/Ruby193/bin/ruby -e 'puts Dir.glob("folder/*/*").each{|f| puts f }.size' folder/человеку медведь/свиньи 1 More ideas? - Bartels.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.