How to read filenames saved as utf8 ( urdu / arabic characters ) in php?
17:40 13 Mar 2015

Please guide me :-
1. How to read / save utf8 characters of filenames saved in Urdu / Arabic language. This worked from me $file_utf8 = iconv( "Windows-1256", "utf-8", $filepath ); , but not reading all filenames, skipping over 80 %. I also need to

2. sort the list of files ( file names ) with respect to time created and size.

3. Save the sorted list in a utf-8 txt file , solved this part with this code : Problem remains that ALL filenames are not read

$myDr = fopen("list.txt", "w") or die("Unable to open file!");                              

foreach ($files as $f) 
    { 
    $path1 = iconv( "Windows-1256", "utf-8", $f ); 
    echo  $zz . " . " . $path1, "
\n"; $txtpoet2 = "$path1 \r\n" ; fwrite($myDr, $txtpoet2); $zz++; } fclose($myDr);

I have many images in directories and sub directories where I saved filename in Urdu language. "ترے عشق کی انتہا چاہتا ہوں.png" . I want to make a list of all directories and sub directories and save in a unicode txt file. I am unable to read the Urdu characters in php coding.

My environment is Windows 7 ( 64 bit) , Using XAMPP - apache as server. I have tried C++ , but could not find the solution.

I am using following PHP to read all files in sub directories:-

\n"; 
    $zz++; 

} 

?>

Source of this code is http://php.net/manual/en/function.readdir.php .

Thanking you all.

php sorting utf-8 filenames urdu