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

killes@www.drop.org’s picture

This 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.

Anonymous’s picture