Here is some example of file names:
漢語.jpg (Chinese)
Федерация.jpg (Russian)
AbÇöişÜĞ.jpg (Turkish, ISO-8859-9)
...
I have tried rawurlencode(mb_convert_encoding($file, "UTF-8", mb_detect_encoding($file))) but this is not working, all Chinese and Russian characters printed as %3F(regular question mark) and all Turkish characters are removed.
I am testing on Windows, PHP 5.3.
Only solution i found is to enter encoding explicitly: rawurlencode(mb_convert_encoding($file, "UTF-8", "ISO-8859-9")) This works only for Turkish characters.
By the way, mb_detect_encoding($file) always returns "UTF-8" for above files.
EDIT:
After i ran the following code i think mb_convert_encoding() cant solve my problem:
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("mp", FilesystemIterator::UNIX_PATHS));
$iterator = new RegexIterator($iterator, '/^.+\.(gif|jpg|jpeg|png)$/i', RegexIterator::GET_MATCH);
foreach ($iterator as $file)
{
foreach (mb_list_encodings() as $encoding)
var_dump(rawurlencode(mb_convert_encoding($file[0], "UTF-8", $encoding)) . " : " . $encoding);
}
I guess this is something about encoding but i don't know how to do.