I have written a php code to read file names from a directory named test under www and print the file name on a web browser. I have some files where the file names are in farsi. But the code is printing ??? on web browser instead of farsi character. I am using 64 bit window 7 pc and wamp as a server. Can anyone please tell me the where I am making mistakes in the below code? Do I also need to change anything in apache or php configuration files or any other files?
You can convert file name to utf-8 with iconv
http://php.net/manual/en/book.iconv.php
If you don't know which encoding your filename will come, firstly you need to learn its encoding.
http://php.net/manual/en/function.iconv-get-encoding.php
$encoding = iconv_get_encoding($filename);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.