If I write:
rename('php109.tmp','test.jpg');
then it's fine and working.
but if I change it into:
rename('php109.tmp','中文.jpg');
it'll report
"No such file or directory...".
But if the multi-byte characters can be written into database then can be read out, then why it fails when it is renamed ?
Did you try doing a
setlocale(LC_ALL, array("es_ES.utf-8","es_ES@euro",'es_ES'));
or whatever your country code is, to make sure the locale is set correctly?If this call does not return something with 'utf-8' in it, it means it failed and will then return the current locale.
File systems do not necessarily use UTF-8. For instance, this is what Wikipedia says about NTFS:
You might need to use iconv() to convert between charsets.
I'm almost sure that the mbstring has nothing to do with this specific problem, I think the problem here relies on the encoding of your .php file.
Try changing the encoding of the file to UTF-8 (no BOM!) in your code editor.
This Sample Should Helps , You Should Find Your Language Code Page And Replace With That. I Test Bellow Code And It Works In Windows For Arabic/Persian Names: