php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41199 scandir etc cannot read Chinese file/folder name
Submitted: 2007-04-26 08:55 UTC Modified: 2016-08-08 10:03 UTC
Votes:6
Avg. Score:4.5 ± 1.1
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:2 (40.0%)
From: n00bp00ns at gmail dot com Assigned:
Status: Wont fix Package: Directory function related
PHP Version: 5.2.1 OS: Vista Home Premium
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: n00bp00ns at gmail dot com
New email:
PHP Version: OS:

 

 [2007-04-26 08:55 UTC] n00bp00ns at gmail dot com
Description:
------------
The directory functions, namely:

opendir();
readdir();
scandir();

only reads english filenames/folders and not chinese and possibly other languages

Ref: http://bugs.php.net/bug.php?id=30195

Reproduce code:
---------------
<?php

$path = "C:/"; // path to file on windows pc
$dir = opendir($path);

while (false !== ($f = readdir($dir)) )
{
	echo $f . "<br />";
}

?>

Expected result:
----------------
Whatever filenames that is in that folder I requested for

Actual result:
--------------
If there are chinese filenames, it'll display as question marks. Not sure about others. I tried reencoding/sending the proper headers too.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-26 09:06 UTC] tony2001@php.net
You have to wait for PHP6 if you want decent Unicode support.
 [2016-08-08 10:03 UTC] ab@php.net
Fixed in PHP 7.1

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 10:01:28 2024 UTC