note 61064 added to class.dir
| From: | samuel dot l at mushicrew dot com | Date: | Tue, 24 Jan 2006 18:52:21 +0000 |
| Subject: | note 61064 added to class.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102387@lists.php.net to get a copy of this message | ||
Note that the dir object will use the default encoding for non-unicode programs on Windows with PHP
5.x.
So, if you have a file named with characters unsupported by the current default encoding, the
dir->read() method will return a wrong entry.
<?php
/*
** This script is on the same directory than a file named with
** unsupported characters for the current default encoding.
*/
$d = dir("./");
while(false !== ($e = $d->read()))
echo $e . '<br/>';
?>
This will print a "?" for every unsupported characters, and not the right file name. So
take care if you check with is_file/is_dir right after enumerating.
----
Server IP: 194.246.101.61
Probable Submitter: 81.56.151.114
----
Manual Page -- http://www.php.net/manual/en/class.dir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61064
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61064&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61064&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61064&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61064&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61064&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61064&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61064&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61064&report=yes
Search -- http://master.php.net/manage/user-notes.php