Bug #61408 [Com]: Character set failure
Edit report at https://bugs.php.net/bug.php?id=61408&edit=1
ID: 61408
Comment by: inge at upandforward dot com
Reported by: inge at upandforward dot com
Summary: Character set failure
Status: Open
Type: Bug
Package: Strings related
Operating System: Linux Ubuntu
PHP Version: 5.3.5-1ubuntu7.7
Block user comment: N
Private report: N
New Comment:
Here's a replacement, but without the $suffix parameter:
function IV_basename($name)
{ $name = strrchr($name,DIRECTORY_SEPARATOR);
if ($name) return substr($name,1);
return false;
}
Previous Comments:
------------------------------------------------------------------------
[2012-03-15 22:55:47] inge at upandforward dot com
There is no return value (it may be false or an empty string), and locale -a does not include
"nb_NO". However, the site is used in Norway for Norwegian users, so it must be able to
handle Norwegian characters. The basename function should not make such distinctions, so I have
written my own - which works independently of locale or character set.
The php version has been corrected above because the bug report did not give that choice. My
suggested replacement could not be uploaded because the site did not accept a text file, even if it
stated that it was the only filetype accepted. I also had great trouble getting the right CAPTCHA
(Oh, yes, I can add numbers! :) )
------------------------------------------------------------------------
[2012-03-15 21:28:20] cataphract@php.net
What's the return value of setlocale? Does locale -a show that locale?
------------------------------------------------------------------------
[2012-03-15 20:14:36] inge at upandforward dot com
Description:
------------
---
From manual page: http://www.php.net/function.basename#refsect1-function.basename-seealso
---
Even if I have defined setlocale('nb_NO.utf8");
the basename functions strips off some national characters.
Test script:
---------------
echo basename('/directory/Ãving.png");
Expected result:
----------------
Ãving.png
Actual result:
--------------
ving.png
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61408&edit=1
Thread (8 messages)