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

From: Date: Thu, 12 Aug 2021 16:13:41 +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-235795@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: janelois202021 at gmail dot com Reported by: percy at savant dot us Summary: scandir etc cannot read Chinese file/folder name Status: Closed Type: Bug Package: *Directory/Filesystem functions Operating System: windows xp/2003 PHP Version: 5CVS-2004-09-22 (dev) Assigned To: ab Block user comment: N Private report: N New Comment: By using the opendir and readdir or scandir can only read English file / folder name; unrecognized code for Chinese File and folder name. The other two are equivalent but should be checked first if possible so that you don't lose your data during importation, as they may not yet be valid in most languages ​​unless known beforehand. If any non-ASCII characters appear at offset 0x6b8, then this will cause an exception when attempting to access a text directory containing an invalid program is tried by default - see above tips on importing programs into another system source: https://www.eworldtrade.com/importers/quartz-stone-buyer/ Previous Comments: ------------------------------------------------------------------------ [2016-09-14 00:04:54] ab@php.net Fixed in PHP 7.1. Please read UPGRADING. thanks. ------------------------------------------------------------------------ [2014-09-20 16:36:16] bsy at breadlab dot net All solutions above didn't solve the problem in php5.2.12. I'm using Korean Windows7 and failed to print japanese characters. But my system could print Korean, special letters(like ☆), and the characters that are used in both Korean and Japanese. For example, 靑 is used in Korean and 青 is used in Japanese. Then my system prints only the former. ------------------------------------------------------------------------ [2011-11-04 12:45:52] martin dot keckeis1 at gmail dot com 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. ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ 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

« previous php.bugs (#235795) next »