I am using rename() to move a file from one folder to another with php.
It works fine with folders which don’t have the swedish å ä ö characters involved.
Is there any way around this? (except for changing the folder names to something without special chars)
The website is entirely in utf-8 format…
This seems to be a bit of a grey area looking at the the manual chapter on
rename()and the User Contributed Notes. There is no word on what encoding should be used. Anyway, if the filesystem supports it, it should be possible to use UTF-8 in file names.This SO question has a very clever answer to work around this. It’s not 100% pure-bred, but probably workable in most cases.
If the characters you are using are also available in
iso-8859-1, you could also try a simpleutf8_decode(). But that solution is not complete and not perfect, as it will fail on characters outside the map.