Bug #54977 [Dup]: UTF-8 files and folder are not shown
| From: | andrea dot rizzini at slidepath dot com | Date: | Thu, 02 Jun 2011 14:11:44 +0000 |
| Subject: | Bug #54977 [Dup]: UTF-8 files and folder are not shown | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161132@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54977&edit=1
ID: 54977
User updated by: andrea dot rizzini at slidepath dot com
Reported by: andrea dot rizzini at slidepath dot com
Summary: UTF-8 files and folder are not shown
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:
Well as you know window 7 is the base of window 2008 R1 and window 2008 R2 servers while window 2003
server is based on the vista. Both of these systems use Unicode - UCS-2LE character encoding.
Any ideas on when it will be fixed?
Could you suggest a workaround or a temporary fix?
I'm building a PHP extension with BOOST and WString in order to amend to this shortfall. Is
there any suggestion to can tell me?
You help is very appreciated.
Regards
Andrea
Previous Comments:
------------------------------------------------------------------------
[2011-06-02 14:17:37] pajoye@php.net
There is already a request about supporting unicode FS on Windows.
------------------------------------------------------------------------
[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