UTF-8 error when using Dir.glob with File::FNM_CASEFOLD

I have a line in an application like this (search the given directory
for ogg and mp3 files):

Dir.glob “#{ARGV[0]}/**/*.{ogg,mp3}”, File::FNM_CASEFOLD

Using Ruby 1.9.3, this raises an error:

test.rb:1:in glob': invalid byte sequence in UTF-8 (ArgumentError) from test.rb:1:in

I guess I have a weird file name somewhere. However, if I drop the
File::FNM_CASEFOLD, then it works fine.

Is there a way to work around this, or at least not stop the globbing
when this occurs? Or am I running into a bug?

Thanks,
Justin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs