|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39660 no multibyte support for Directory/Filesystem function
Submitted: 2006-11-28 14:39 UTC Modified: 2006-11-28 14:50 UTC
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: dominikseifert at yahoo dot de Assigned:
Status: Wont fix Package: *Directory/Filesystem functions
PHP Version: 5.2.0 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
28 - 2 = ?
Subscribe to this entry?

 [2006-11-28 14:39 UTC] dominikseifert at yahoo dot de
Directory/Filesystem functions do not work with multibyte-strings.
When eg trying to open or move a file or directory with a chinese filename, the file or directory being accessed or created has a completely messed up name.
Could not find a work-around.

Reproduce code:
// Multibyte support is enabled (UTF-8)

// change this correspondingly for your FS
$origFile = "c:/myfile.txt";

$chineseName = $_POST["filename"];

echo "name: " . $chineseName;
echo "len: " . mb_strlen($chineseName);
echo "sb-len: " . strlen($chineseName);

$dir = dirname($origFile);
rename($origFile, $dir . "/$chineseName") or die("Could not rename file: $origFile");

Expected result:
name: 中文字.txt
len: 7
sb-len: 13

Actual result:
Actual filename is:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-28 14:50 UTC]
Yes, you have to wait for PHP6 to get decent Unicode support.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 23 07:01:25 2023 UTC