Directory names with accent marks


#1

Is there a solution to the problem which has been around for quite some time of “file not found” when attempting to open a file who’s directory contains an accent mark?

Joe…


#2

“Don’t do that” is the best advice I can give. There is somewhere a list of “forbidden” characters in Windows or Mac file and folder names, and I strongly recommend that you observe it. Personally I seem to find that it is best to limit to the old set of ASCII characters and numbers whenever possible.

Anssi


#3

Thanks for the reply and advice Anssi. Unfortunately the problems stem from users of my scripts who have user names with accents. I was hoping not to have to suggest they change user name, but perhaps doing so may save them from other problems.

Thanks again,
Joe…


#4

So this is a Ruby related query ?
Up until v2014 accented file paths were a guaranteed fail
To get a possibly valid reference I use something like this in code - it gets the folder-path of the running script…

if defined?(Encoding)
    mypath=File.dirname(__FILE__).force_encoding("UTF-8")
    ### >= v2014 lashup, should work with accents in user-names etc
else
    mypath=File.dirname(__FILE__) 
    ### < v2014, might fail with accents in user-names etc
end
### Now 'mypath' is a reference to the path of this script's folder...
### typically .../Plugins
myfolder=File.join(mypath, "MyToolName")
### typically .../Plugins/MyToolName