#30195 [Fbk->NoF]: scandir etc cannot read Chinese file/folder name

From: Date: Fri, 25 Feb 2005 00:00:09 +0000
Subject: #30195 [Fbk->NoF]: scandir etc cannot read Chinese file/folder name
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74519@lists.php.net to get a copy of this message
ID: 30195 Updated by: php-bugs@lists.php.net Reported By: percy at savant dot us -Status: Feedback +Status: No Feedback Bug Type: *Directory/Filesystem functions Operating System: windows xp/2003 PHP Version: 5CVS-2004-09-22 (dev) New Comment: 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". Previous Comments: ------------------------------------------------------------------------ [2005-02-17 15:22:16] moriyoshi@php.net Note that all of these are PHP code, so paste it within <?php ?>. ------------------------------------------------------------------------ [2005-02-17 15:20:57] moriyoshi@php.net 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() ------------------------------------------------------------------------ [2004-12-27 15:39:53] dev at glossword dot info There is the same problem with php 5.0.2. How to reproduce: 1. Create file wø&#1575;&#12450;&#12356;&#1504;.txt (urlencoded string is w%d1%88%d8%a7%e3%82%a2%e3%81%84%d7%a0.txt) 2. Read directory, readdir(). 3. You'll get w&#248;????.txt (w%c3%b8????.txt) instead of proper name. With this bug, it is impossible to manage multilingual file names. ------------------------------------------------------------------------ [2004-11-18 18:50:04] phoenix95 at hotmail dot com I'm not 100% sure we have the same problem... What I experienced is readdir choking on directory names with special characters like an e acute. I use PHP 4.3.9 in debug mode from the Komodo v.3 IDE on Windows XP Pro SP2 english. This happens with the PEAR package File_Find::mapTreeMultiple(). ------------------------------------------------------------------------ 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

« previous php.bugs (#74519) next »