Bug #30195 [Com]: scandir etc cannot read Chinese file/folder name

From: Date: Fri, 04 Nov 2011 12:45:53 +0000
Subject: Bug #30195 [Com]: scandir etc cannot read Chinese file/folder name
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-164877@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=30195&edit=1

 ID:                 30195
 Comment by:         martin dot keckeis1 at gmail dot com
 Reported by:        percy at savant dot us
 Summary:            scandir etc cannot read Chinese file/folder name
 Status:             No Feedback
 Type:               Bug
 Package:            *Directory/Filesystem functions
 Operating System:   windows xp/2003
 PHP Version:        5CVS-2004-09-22 (dev)
 Block user comment: N
 Private report:     N

 New Comment:

Its a problem in PHP general.

This could have been solved with PHP 6.0 (general multibyte support).

There are some workarounds in the internet with the windows console.


Previous Comments:
------------------------------------------------------------------------
[2011-06-07 00:08:23] spidgorny at gmail dot com

Same problem (files with question marks) with Russian files in PHP 5.3.0 on Windows 7.
mb_convert_encoding() can't help converting question marks.
Maybe DirectoryIterator will help.

------------------------------------------------------------------------
[2010-08-29 18:13:24] onekamil at gmail dot com

Hi, have the same problem and my solution is: using mb_convert_encoding.

$open = opendir($path);
foreach( $open as $value ) 
{
   $value = mb_convert_encoding($value, mb_detect_order($value), "UTF-8");
}

If saving file to folder using urlencode. To view using urldecode.

------------------------------------------------------------------------
[2007-03-31 23:30:05] missingno at ifrance dot com

Same problem here.

On WinXP with PHP 5.2.0, using iso-8859-1 as charset for the system (though the filesystem uses
utf-8 for folders/files names).

I need to access folders whose names are encoded using UTF-8.
readdir/scandir won't allow me to do so (returning '?' for characters outside the
system charset).


The page is served like this:
header('Content-Type: text/html; charset=utf-8');
So the browser really isn't at fault.
Serving the document with a more specific charset is not an option since I have to display texts in
many different languages on the page.

As moleary at preg dot org suggested, it would be really nice to have an option to force PHP to use
a certain encoding while accessing the filesystem. Or maybe, make it so that it uses the same
encoding as the filesystem instead of defaulting to iso-8859-1...

------------------------------------------------------------------------
[2006-07-10 10:02:31] gandhavallakiran at yahoo dot co dot in

hi i have used the babel class in my coding of php. but it could not read the characters of china
and japan i.e. special characters. it is displaying the blank space instead of china or  japan text.
could you help me in this reacord how to display china characters in php. please it is very urgent
kindly help me.

------------------------------------------------------------------------
[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".

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


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

    https://bugs.php.net/bug.php?id=30195


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


Thread (33 messages)

« previous php.bugs (#164877) next »