PHP rename failed for filename with utf-8 arabic charset string -


i have issue php rename function, fail if file name in arabic words spaces.

e.g.

rename(temp/أم كلثوم       ثوار - ثوار.mp3,audio/13408831061.mp3); 

no such file or directory in (path)

please note: أم كلثومxxxxxxxxثوار - ثوار.mp3

xxxxxxx here atleast 6 spaces.

i tried urlencode() still no result.

any suggestion!

to check $file_id correct, on unix-like system:

echo "<pre>\n"; // html output system("echo -n '$file_id' | od -tx1"); 

with value, should reported filename (you can echo check)

$file_id = "\xd9\x83\xd9\x84\xd8\xab\xd9\x88\xd9\x85 \xd8\xab\xd9\x88\xd8\xa7\xd8\xb1 - \xd8\xab\xd9\x88\xd8\xa7\xd8\xb1.mp3"; 

the output is

0000000 d9 83 d9 84 d8 ab d9 88 d9 85 20 d8 ab d9 88 d8 0000020 a7 d8 b1 20 2d 20 d8 ab d9 88 d8 a7 d8 b1 2e 6d 0000040 70 33 0000042 

(as can see, sequence ending b1 repeats itself, last 4 bytes .mp3)

in directory file should can issue a

ls -1 | od -tx1 

and see filenames separated 0a newlines.

if both outputs match, problem somewhere in php or in system (both unlikely), if don't have chase problem in code, starting encoding, must utf-8 everywhere.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -