|  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: dominikseifert at yahoo dot de
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 09:01:28 2024 UTC