|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-06-08 12:54 UTC] svmk-tmsk at yandex dot ru
Description:
------------
PHP version - PHP 5.4.9-4ubuntu2 (cli) (built: Mar 11 2013 16:05:09)
Function basename works incorrect with spaces in cyrillic encoding. This function separates filename by a space. For example basename("www/abc defg") = "defg". It should be "abc defg". The letters should be in Cyrillic like 'абв где'.
1. Set locale ru_RU.UTF-8
2. Run this code echo basename('абв где');
3. basename return 'где'. basename must return 'абв где'.
Test script:
---------------
echo basename('абв где');
Expected result:
----------------
baseline function should't divide string by space.
Actual result:
--------------
basename('путь до каталога/абв где') = 'где'
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 06:00:02 2025 UTC |
Are you sure you are using UTF-8 and not CP1251 there? You set your locale to UTF8, and I tested your code with the UTF8: echo basename('абв где'); And it works just fine. eg. php > echo basename('путь до каталога/абв где'); абв где If you are using CP1251 you can try calling: mb_internal_encoding("CP1251"); before your basename() call. Does it change anything?