Answer the question
In order to leave comments, you need to log in
PHP opendir() not displaying Cyrillic folders?
The task is to develop a file manager, started.
The first thing I encountered was that opendir does not display folders in Russian, and accordingly does not go to them.
Here is the code, in the documents directory is the "New Folder" folder. It displays it like this:
Here is the code
self::$path = $_SERVER['DOCUMENT_ROOT'].'/public/cloud/documents/';
$dir = scandir(self::$path);
$files = array(
'dir' => array(),
'file' => array()
);
foreach($dir as $el){
if(is_dir(self::$path.$el)){
$files['dir'][] = $el;
}else{
$files['file'][] = $el;
}
}
iconv('utf-8','Windows-1252',$_SERVER['DOCUMENT_ROOT'].'/public/cloud/documents/');
Answer the question
In order to leave comments, you need to log in
Are meta-charset explicitly specified in the page code? It won't work in webkits otherwise / won't always work.
I understand that the question was asked more than three years ago, but there is still no answer.
You have an error in the iconv function, you need to swap the encodings.
False: Correct : iconv('utf-8', 'Windows-1252', string)
iconv('Windows-1251', 'UTF-8', string)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question