ID:               30195
 Comment by:       maxime dot pacary at freesbee dot fr
 Reported By:      percy at savant dot us
 Status:           No Feedback
 Bug Type:         *Directory/Filesystem functions
 Operating System: windows xp/2003
 PHP Version:      5CVS-2004-09-22 (dev)
 New Comment:

Sorry, it was not GB2313 but GB2312 of course.


Previous Comments:
------------------------------------------------------------------------

[2005-09-20 19:32:29] 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 GB2313 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,

Frosty

------------------------------------------------------------------------

[2005-02-25 01:00:07] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2005-02-17 15:22:16] [EMAIL PROTECTED]

Note that all of these are PHP code, so paste it within 
<?php ?>.


------------------------------------------------------------------------

[2005-02-17 15:20:57] [EMAIL PROTECTED]

You might have shown strings of a native encoding as 
UTF-8 in your browser, most likely because of wrong 
Content-Type.

Try putting one of the following at the top of your 
script and let's see what'll happen:

CP936 (Simplified Chinese):

  header('Content-Type', 'text/html; charset=GB2312');

CP949 (Korean):

  header('Content-Type', 'text/html; charset=EUC-KR');

CP950 (Traditional Chinese):

  header('Content-Type', 'text/html; charset=BIG5');

CP932 (Japanese):

  header('Content-Type', 'text/html; 
charset=Shift_JIS');



------------------------------------------------------------------------

[2005-01-28 18:02:07] moleary at preg dot org

This is also the case for Japanese characters on the Windows platform. 
A note in the PHP manual says that opendir() uses ISO 8859-1 by default
on WIndows installations.

REPRO:
1) Install East Asian language supprto to XP through the Regioanl
languages control panel
2) add a file with Japanese characters as the name (I copied a couple
strings from the asahi.com web site)

ACTUAL:
1) These same characters as text will be presented properly with the
proper code page and/or header encoding.
2) The characters are not correctly parsed when looping through the
contents of an opendir() on the directory in which you placed the file
you created under the repro steps.

EXPECTED:
Ability to define charset for opendir(), or at very least use a more
standard UTF-8 instead of ISO 8859-1 so that Asian named files can have
their proper names returned by opendir()

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/30195

-- 
Edit this bug report at http://bugs.php.net/?id=30195&edit=1

Reply via email to