|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34574 scandir() and readdir() do not support Unicode filenames
Submitted: 2005-09-21 10:14 UTC Modified: 2005-09-21 16:56 UTC
From: maxime dot pacary at winsoft dot fr Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 5.0.5 OS: Windows XP, 2003
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: maxime dot pacary at winsoft dot fr
New email:
PHP Version: OS:


 [2005-09-21 10:14 UTC] maxime dot pacary at winsoft dot fr
Hello PHP team,

When I try to use scandir() and readdir() to get the content of a directory, if a file/dir name contains non iso-8859-1 characters, it is not retrieved correctly in PHP.

e.g. (real dir name => result in PHP)

test1 => test1
test2łćęśż => test2lcesz
test3我很高兴 => test3????

chdir() does not work as well when trying to change to a directory containing such characters (error: no such file or directory)

And when I just try to execute a PHP script in such a directory - I get the following errors :
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Warning: Unknown: Failed opening 'D:\MAX\Source\test\test4我很高兴\index.php' for inclusion (include_path='.;C:\php5\pear') in Unknown on line 0

I have tried using GB2312 and UTF-8 Content-Type headers (suggested by moriyoshi), and checked the "real" content of the retrieved string, but there are (e.g. for chinese) only '?' characters (ASCII 63), nothing else "hidden" by something like a wrong charset.

Thank you for your attention,


NB. I have already added this message as a comment for bug #30195, so if you want you can mark this bug as duplicate ; I have created a new bug, because when you add a comment to a bug already in 'No feedback' status, its status does not change so the bug remains 'buried' in the deep darkness of the bugs waiting for feedback...

It would be better if a bug status changes back to 'Open' or 'Feedback' when a comment is added...

Thank you,



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-21 16:16 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

PHP does not support unicode operations until PHP6.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 08:01:28 2024 UTC