|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-28 14:50 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 02:00:01 2025 UTC |
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