Bug #54977 [Opn->Dup]: UTF-8 files and folder are not shown
Edit report at http://bugs.php.net/bug.php?id=54977&edit=1
ID: 54977
Updated by: pajoye@php.net
Reported by: andrea dot rizzini at slidepath dot com
Summary: UTF-8 files and folder are not shown
-Status: Open
+Status: Duplicate
Type: Bug
Package: Filesystem function related
Operating System: Window 7
PHP Version: 5.2.17
Block user comment: N
Private report: N
New Comment:
There is already a request about supporting unicode FS on Windows.
Previous Comments:
------------------------------------------------------------------------
[2011-06-02 14:15:54] andrea dot rizzini at slidepath dot com
Description:
------------
Listing the content of a directory using the standard php functions does not return any files or
folders which have UTF-8 charcters.
Windows 7 Supports Unicode "UCS-2LE" so you can create any folder / files like the
following: (ç (king in Japanese) and æ±ãã¦æã (dirty dog on Japanese)).
If you list the directory where you have these files you will get ?????, ?????.
After a bit of investigation I've noticed that PHP internally treats any string literal in
ISO8859-1.
I've tried to change the default encoding to UTF-8 in the php.ini but IT DOES NOT WORK.
Test script:
---------------
Create several UTF-8 folders using chinese or japanese character.
List them using the standard php function opendir like:
$myDirectory = opendir(".");
// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
// close directory
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
Print ("$indexCount files<br>\n");
Notice that the UTF-8 encoded files are returned as ???????
Expected result:
----------------
It should return the full list of directoried including directories with UTF-8 encoded name
Actual result:
--------------
It only return folders which have a characters contained in IS08859-1 .
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54977&edit=1
Thread (3 messages)