#15706 [Fbk->Ana]: readdir doesn't return correct FRENCH filenames
| From: | sfox@php.net | Date: | Mon, 05 Aug 2002 12:30:01 +0000 |
| Subject: | #15706 [Fbk->Ana]: readdir doesn't return correct FRENCH filenames | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-16012@lists.php.net to get a copy of this message | ||
ID: 15706
Updated by: sfox@php.net
Reported By: musallam@sympatico.ca
-Status: Feedback
+Status: Analyzed
Bug Type: Directory function related
Operating System: WIN XP
PHP Version: 4.1.1
New Comment:
I just spent some days playing with this one before coming to the
conclusion that it's not a PHP bug *as such*, more to do with MS
character types not being ANSI-compatible. The PHP directory functions
for win32 use MS functions which return MS-defined char types (as
opposed to the PHP string functions, which don't touch MS and which
work fine :). We use those to set up win32 directory functions in a
way that is as nearly as possible compatible with unix-flavoured
systems, and the returned char type is then used throughout the
universal directory functions.
Unfortunately 'char' in this instance means 'single byte'.
Fixing the win32 dir functions within PHP to make it possible for other
MS char types to be used would mean that the wrong type is returned to
the PHP directory functions used by all systems. It appears that the
only way to internationalise PHP in this area would be to separate out
the win32 directory functions completely ..
I'm not happy with the politics of this, particularly given the
widespread use of dir and file names within PHP source (think of
streams, etc). If anyone can think of a better way to implement dirent
for win32, please do!
Previous Comments:
------------------------------------------------------------------------
[2002-07-14 17:54:10] sniper@php.net
Does this happen if you run the same code fragment
on command line?
------------------------------------------------------------------------
[2002-07-14 10:46:22] nohn@php.net
On the Web you should always use 7-Bit ASCII (no german umlauts or
these daft french characters or whatever is no "standard")
------------------------------------------------------------------------
[2002-02-25 17:50:57] musallam@sympatico.ca
I'm not sure either, but fact remains, the letters returned have either
a wrong encoding or wrong string conversion...
------------------------------------------------------------------------
[2002-02-25 06:15:12] sander@php.net
I don't think this is a PHP problem...
------------------------------------------------------------------------
[2002-02-24 23:39:08] musallam@sympatico.ca
hi,
I'm think this is a valid bug :)
I'm trying to list files from a certain directory with readdir() but
any accented capital letter is returned without the accent... I'll
explain:
----------------------------------
my directory listing is:
.
..
Bloqueurs des canaux calciques voltage.doc
Diurétiques.doc
REGF et JNK.pdf
Éicosanoides.doc <--------
----------------------------------
the file pointed by the arrow is returned "Eicosanoides.doc" no accent
on the capital E.
The problem isn't present with lowercase letters, i.e. the filename
"Diurétiques.doc" is returned correctly.
here's my code:
$handle=opendir($dir);
echo "Files:<br>\n";
while (false !== ($file = readdir($handle))) {
echo "<br>$file\n";
}
closedir($handle);
I hope this is enough info, dont hesitate to email me for anything. I'm
running Apache1.3.23 with PHP4.1.1 binaries from php.net
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15706&edit=1