|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-06-02 14:17 UTC] pajoye@php.net
-Status: Open
+Status: Duplicate
[2011-06-02 14:17 UTC] pajoye@php.net
[2011-06-02 16:11 UTC] andrea dot rizzini at slidepath dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 07:00:02 2025 UTC |
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 .