Forum: Ruby File.exist? not working when directory contain letters like 'ñ' in its name.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E0d8c2f6e65b6fce72a5c20da9d7adbe?d=identicon&s=25 chandan mallik (chandan0707)
on 2013-03-22 10:59
File.exist? in not working with directory name having special
characters. for something like given below
path =
"/home/cis/Desktop/'El%20POP%20que%20llevas%20dentro%20Vol.%202'/*.mp3"

it works fine but if it has letters like ñ its returns false.
Plz help with this.
5b972395a92333843018b4add8af0437?d=identicon&s=25 Damián M. González (igorjorobus)
on 2013-03-22 13:08
If you are not working with 2.0 you should use:

#encode: utf-8

 ...in the top of the script. Also you have to have the correct encoding
configuration(utf-8 in this case) in your IDE. If that not solve your
problem you will have to play with encode(), encoding() and
force_encoding() string methods. Check out the documentation.
This topic is locked and can not be replied to.