I am using a function Rename() (php) to move some images from one folder to another.

The destination folder has special characters in them.

However, when doing this on the server I get the error that the folder isn't found with the name. And in that error, the folder names special characters are replaced with Squares:

Warning: rename(../temp_images/668635375_1.jpg,../ad_images/B�tar/thumbs/668635375_1.jpg)
[function.rename]: No such file or directory in /var/www/etc....

It works on my local machine though (windows xp).

Any ideas? Troubleshooting tips?

Thanks

Accepted Answer

I assume this is an encoding problem at some point.

However, using non-ASCII characters in file names is a slippery slope anyway.

I always recommend (since another SO user made me aware of that great and simple idea) that if you can, urlencode() file names and urldecode() them when serving them to the public. This will give you a file name consisting of characters that work on every file system known to me, and can hold any Unicode character.

Written by Pekka
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki