php.net |  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
Votes:3
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-11-28 14:39 UTC] dominikseifert at yahoo dot de
Description:
------------
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:
中文字.txt

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-28 14:50 UTC] tony2001@php.net
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 Apr 18 15:01:28 2024 UTC