#37738 [Opn->WFx]: basename does not work with Japanese
| From: | derick@php.net | Date: | Thu, 08 Jun 2006 06:37:11 +0000 |
| Subject: | #37738 [Opn->WFx]: basename does not work with Japanese | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-98158@lists.php.net to get a copy of this message | ||
ID: 37738
Updated by: derick@php.net
Reported By: joey at alegria dot co dot jp
-Status: Open
+Status: Wont fix
Bug Type: *Directory/Filesystem functions
Operating System: Fedora Core 4
PHP Version: 5CVS-2006-06-08 (CVS)
New Comment:
Won't fix in PHP 5. This will be implemented for PHP 6.
Previous Comments:
------------------------------------------------------------------------
[2006-06-08 06:09:54] joey at alegria dot co dot jp
Description:
------------
Simply put, basename() does ot work with Japanese filepaths. If the
filename is Japanese only the extension part of the filename is
returned. So a filename "/folder/t@C¼.txt" resolves to just
".txt". I discovered the problem when performing a basename() on the
$_FILES array's 'name' element for uploaded Japanese files, however
after testing the bug occurs no matter how you supply the filename.
My PHP environment is running with UTF-8 internal encoding.
The code snippet below illustrates this perfectly.
Reproduce code:
---------------
<?php
// show normal behavior with roman filename
$filename='/myfolder/roman_filename.txt';
echo "The full filename of the romanized file is $filename.\n"; //
/myfolder/roman_filename.txt
$basename=basename($filename);
echo "The basename of the romanized file is $basename.\n"; //
/roman_filename.txt
// show behavior with Japanese filename
$filename='/myfolder/ú{êÌt@C¼.txt';
echo "The full filename of the Japanese file is $filename.\n"; //
/myfolder/ú{êÌt@C¼.txt
$basename=basename($filename);
echo "The basename of the Japanese file is $basename."; // .txt
?>
Expected result:
----------------
The full filename of the romanized file is
/myfolder/roman_filename.txt.
The basename of the romanized file is roman_filename.txt.
The full filename of the Japanese file is
/myfolder/ú{êÌt@C¼.txt.
The basename of the Japanese file is ú{êÌt@C¼.txt.
Actual result:
--------------
The full filename of the romanized file is
/myfolder/roman_filename.txt.
The basename of the romanized file is roman_filename.txt.
The full filename of the Japanese file is
/myfolder/ú{êÌt@C¼.txt.
The basename of the Japanese file is .txt.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37738&edit=1