Closed (fixed)
Project:
Drupal core
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
18 Aug 2004 at 23:46 UTC
Updated:
2 Sep 2004 at 00:20 UTC
function drupal_set_title($title = NULL) {
static $stored_title;
if (isset($title)) {
$stored_title = ucfirst($title);
}
return $stored_title;
}
The function ucfirst doesn't work with utf-8. Since there isn't a mb_ucfirst, I wrote it.
function mb_ucfirst (
$string,
$encoding = NULL)
{
if ($encoding)
{
return mb_strtoupper (mb_substr ($string, 0, 1, $encoding), $encoding) . mb_substr ($string, 1, mb_strlen ($string, $encoding) - 1, $encoding);
}
else
{
return mb_strtoupper (mb_substr ($string, 0, 1)) . mb_substr ($string, 1, mb_strlen ($string) - 1);
}
}
I patched drupal_set_title :
function drupal_set_title($title = NULL) {
static $stored_title;
if (isset($title)) {
$stored_title = mb_ucfirst($title, mb_detect_encoding($title));
}
return $stored_title;
}
And voilà. Note : the functions menu_get_active_title, help_help, title_page, tracker_posts and user_validate_authmap are also affected.
Fabrice f0211(at)mac(dot)com
Comments
Comment #1
killes@www.drop.org commentedThis is fixed in the cvs version. We don't use ucfirst anymore. We can't use mb_strtoupper & Co because those aren't everywhere available.
Comment #2
(not verified) commented